
bin/kernel：     文件格式 elf32-i386


Disassembly of section .text:

c0100000 <kern_entry>:

.text
.globl kern_entry
kern_entry:
    # load pa of boot pgdir
    movl $REALLOC(__boot_pgdir), %eax
c0100000:	b8 00 90 12 00       	mov    $0x129000,%eax
    movl %eax, %cr3
c0100005:	0f 22 d8             	mov    %eax,%cr3

    # enable paging
    movl %cr0, %eax
c0100008:	0f 20 c0             	mov    %cr0,%eax
    orl $(CR0_PE | CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_TS | CR0_EM | CR0_MP), %eax
c010000b:	0d 2f 00 05 80       	or     $0x8005002f,%eax
    andl $~(CR0_TS | CR0_EM), %eax
c0100010:	83 e0 f3             	and    $0xfffffff3,%eax
    movl %eax, %cr0
c0100013:	0f 22 c0             	mov    %eax,%cr0

    # update eip
    # now, eip = 0x1.....
    leal next, %eax
c0100016:	8d 05 1e 00 10 c0    	lea    0xc010001e,%eax
    # set eip = KERNBASE + 0x1.....
    jmp *%eax
c010001c:	ff e0                	jmp    *%eax

c010001e <next>:
next:

    # unmap va 0 ~ 4M, it's temporary mapping
    xorl %eax, %eax
c010001e:	31 c0                	xor    %eax,%eax
    movl %eax, __boot_pgdir
c0100020:	a3 00 90 12 c0       	mov    %eax,0xc0129000

    # set ebp, esp
    movl $0x0, %ebp
c0100025:	bd 00 00 00 00       	mov    $0x0,%ebp
    # the kernel stack region is from bootstack -- bootstacktop,
    # the kernel stack size is KSTACKSIZE (8KB)defined in memlayout.h
    movl $bootstacktop, %esp
c010002a:	bc 00 80 12 c0       	mov    $0xc0128000,%esp
    # now kernel stack is ready , call the first C function
    call kern_init
c010002f:	e8 02 00 00 00       	call   c0100036 <kern_init>

c0100034 <spin>:

# should never get here
spin:
    jmp spin
c0100034:	eb fe                	jmp    c0100034 <spin>

c0100036 <kern_init>:
int kern_init(void) __attribute__((noreturn));
void grade_backtrace(void);
static void lab1_switch_test(void);

int
kern_init(void) {
c0100036:	f3 0f 1e fb          	endbr32 
c010003a:	55                   	push   %ebp
c010003b:	89 e5                	mov    %esp,%ebp
c010003d:	83 ec 28             	sub    $0x28,%esp
    extern char edata[], end[];
    memset(edata, 0, end - edata);
c0100040:	b8 4c e1 12 c0       	mov    $0xc012e14c,%eax
c0100045:	2d 00 b0 12 c0       	sub    $0xc012b000,%eax
c010004a:	89 44 24 08          	mov    %eax,0x8(%esp)
c010004e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100055:	00 
c0100056:	c7 04 24 00 b0 12 c0 	movl   $0xc012b000,(%esp)
c010005d:	e8 dc 96 00 00       	call   c010973e <memset>

    cons_init();                // init the console
c0100062:	e8 14 1e 00 00       	call   c0101e7b <cons_init>

    const char *message = "(THU.CST) os is loading ...";
c0100067:	c7 45 f4 80 a0 10 c0 	movl   $0xc010a080,-0xc(%ebp)
    cprintf("%s\n\n", message);
c010006e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100071:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100075:	c7 04 24 9c a0 10 c0 	movl   $0xc010a09c,(%esp)
c010007c:	e8 50 02 00 00       	call   c01002d1 <cprintf>

    print_kerninfo();
c0100081:	e8 0e 09 00 00       	call   c0100994 <print_kerninfo>

    grade_backtrace();
c0100086:	e8 ac 00 00 00       	call   c0100137 <grade_backtrace>

    pmm_init();                 // init physical memory management
c010008b:	e8 4f 73 00 00       	call   c01073df <pmm_init>

    pic_init();                 // init interrupt controller
c0100090:	e8 61 1f 00 00       	call   c0101ff6 <pic_init>
    idt_init();                 // init interrupt descriptor table
c0100095:	e8 06 21 00 00       	call   c01021a0 <idt_init>

    vmm_init();                 // init virtual memory management
c010009a:	e8 e4 35 00 00       	call   c0103683 <vmm_init>
    proc_init();                // init process table
c010009f:	e8 1d 90 00 00       	call   c01090c1 <proc_init>
    
    ide_init();                 // init ide devices
c01000a4:	e8 07 0d 00 00       	call   c0100db0 <ide_init>
    swap_init();                // init swap
c01000a9:	e8 8c 3f 00 00       	call   c010403a <swap_init>

    clock_init();               // init clock interrupt
c01000ae:	e8 0f 15 00 00       	call   c01015c2 <clock_init>
    intr_enable();              // enable irq interrupt
c01000b3:	e8 8a 20 00 00       	call   c0102142 <intr_enable>

    //LAB1: CAHLLENGE 1 If you try to do it, uncomment lab1_switch_test()
    // user/kernel mode switch test
    //lab1_switch_test();
    
    cpu_idle();                 // run idle process
c01000b8:	e8 c5 91 00 00       	call   c0109282 <cpu_idle>

c01000bd <grade_backtrace2>:
}

void __attribute__((noinline))
grade_backtrace2(int arg0, int arg1, int arg2, int arg3) {
c01000bd:	f3 0f 1e fb          	endbr32 
c01000c1:	55                   	push   %ebp
c01000c2:	89 e5                	mov    %esp,%ebp
c01000c4:	83 ec 18             	sub    $0x18,%esp
    mon_backtrace(0, NULL, NULL);
c01000c7:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01000ce:	00 
c01000cf:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01000d6:	00 
c01000d7:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01000de:	e8 5a 0c 00 00       	call   c0100d3d <mon_backtrace>
}
c01000e3:	90                   	nop
c01000e4:	c9                   	leave  
c01000e5:	c3                   	ret    

c01000e6 <grade_backtrace1>:

void __attribute__((noinline))
grade_backtrace1(int arg0, int arg1) {
c01000e6:	f3 0f 1e fb          	endbr32 
c01000ea:	55                   	push   %ebp
c01000eb:	89 e5                	mov    %esp,%ebp
c01000ed:	53                   	push   %ebx
c01000ee:	83 ec 14             	sub    $0x14,%esp
    grade_backtrace2(arg0, (int)&arg0, arg1, (int)&arg1);
c01000f1:	8d 4d 0c             	lea    0xc(%ebp),%ecx
c01000f4:	8b 55 0c             	mov    0xc(%ebp),%edx
c01000f7:	8d 5d 08             	lea    0x8(%ebp),%ebx
c01000fa:	8b 45 08             	mov    0x8(%ebp),%eax
c01000fd:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0100101:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100105:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0100109:	89 04 24             	mov    %eax,(%esp)
c010010c:	e8 ac ff ff ff       	call   c01000bd <grade_backtrace2>
}
c0100111:	90                   	nop
c0100112:	83 c4 14             	add    $0x14,%esp
c0100115:	5b                   	pop    %ebx
c0100116:	5d                   	pop    %ebp
c0100117:	c3                   	ret    

c0100118 <grade_backtrace0>:

void __attribute__((noinline))
grade_backtrace0(int arg0, int arg1, int arg2) {
c0100118:	f3 0f 1e fb          	endbr32 
c010011c:	55                   	push   %ebp
c010011d:	89 e5                	mov    %esp,%ebp
c010011f:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace1(arg0, arg2);
c0100122:	8b 45 10             	mov    0x10(%ebp),%eax
c0100125:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100129:	8b 45 08             	mov    0x8(%ebp),%eax
c010012c:	89 04 24             	mov    %eax,(%esp)
c010012f:	e8 b2 ff ff ff       	call   c01000e6 <grade_backtrace1>
}
c0100134:	90                   	nop
c0100135:	c9                   	leave  
c0100136:	c3                   	ret    

c0100137 <grade_backtrace>:

void
grade_backtrace(void) {
c0100137:	f3 0f 1e fb          	endbr32 
c010013b:	55                   	push   %ebp
c010013c:	89 e5                	mov    %esp,%ebp
c010013e:	83 ec 18             	sub    $0x18,%esp
    grade_backtrace0(0, (int)kern_init, 0xffff0000);
c0100141:	b8 36 00 10 c0       	mov    $0xc0100036,%eax
c0100146:	c7 44 24 08 00 00 ff 	movl   $0xffff0000,0x8(%esp)
c010014d:	ff 
c010014e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100152:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0100159:	e8 ba ff ff ff       	call   c0100118 <grade_backtrace0>
}
c010015e:	90                   	nop
c010015f:	c9                   	leave  
c0100160:	c3                   	ret    

c0100161 <lab1_print_cur_status>:

static void
lab1_print_cur_status(void) {
c0100161:	f3 0f 1e fb          	endbr32 
c0100165:	55                   	push   %ebp
c0100166:	89 e5                	mov    %esp,%ebp
c0100168:	83 ec 28             	sub    $0x28,%esp
    static int round = 0;
    uint16_t reg1, reg2, reg3, reg4;
    asm volatile (
c010016b:	8c 4d f6             	mov    %cs,-0xa(%ebp)
c010016e:	8c 5d f4             	mov    %ds,-0xc(%ebp)
c0100171:	8c 45 f2             	mov    %es,-0xe(%ebp)
c0100174:	8c 55 f0             	mov    %ss,-0x10(%ebp)
            "mov %%cs, %0;"
            "mov %%ds, %1;"
            "mov %%es, %2;"
            "mov %%ss, %3;"
            : "=m"(reg1), "=m"(reg2), "=m"(reg3), "=m"(reg4));
    cprintf("%d: @ring %d\n", round, reg1 & 3);
c0100177:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010017b:	83 e0 03             	and    $0x3,%eax
c010017e:	89 c2                	mov    %eax,%edx
c0100180:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c0100185:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100189:	89 44 24 04          	mov    %eax,0x4(%esp)
c010018d:	c7 04 24 a1 a0 10 c0 	movl   $0xc010a0a1,(%esp)
c0100194:	e8 38 01 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  cs = %x\n", round, reg1);
c0100199:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010019d:	89 c2                	mov    %eax,%edx
c010019f:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c01001a4:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001a8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001ac:	c7 04 24 af a0 10 c0 	movl   $0xc010a0af,(%esp)
c01001b3:	e8 19 01 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  ds = %x\n", round, reg2);
c01001b8:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c01001bc:	89 c2                	mov    %eax,%edx
c01001be:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c01001c3:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001c7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001cb:	c7 04 24 bd a0 10 c0 	movl   $0xc010a0bd,(%esp)
c01001d2:	e8 fa 00 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  es = %x\n", round, reg3);
c01001d7:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01001db:	89 c2                	mov    %eax,%edx
c01001dd:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c01001e2:	89 54 24 08          	mov    %edx,0x8(%esp)
c01001e6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01001ea:	c7 04 24 cb a0 10 c0 	movl   $0xc010a0cb,(%esp)
c01001f1:	e8 db 00 00 00       	call   c01002d1 <cprintf>
    cprintf("%d:  ss = %x\n", round, reg4);
c01001f6:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
c01001fa:	89 c2                	mov    %eax,%edx
c01001fc:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c0100201:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100205:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100209:	c7 04 24 d9 a0 10 c0 	movl   $0xc010a0d9,(%esp)
c0100210:	e8 bc 00 00 00       	call   c01002d1 <cprintf>
    round ++;
c0100215:	a1 00 b0 12 c0       	mov    0xc012b000,%eax
c010021a:	40                   	inc    %eax
c010021b:	a3 00 b0 12 c0       	mov    %eax,0xc012b000
}
c0100220:	90                   	nop
c0100221:	c9                   	leave  
c0100222:	c3                   	ret    

c0100223 <lab1_switch_to_user>:

static void
lab1_switch_to_user(void) {
c0100223:	f3 0f 1e fb          	endbr32 
c0100227:	55                   	push   %ebp
c0100228:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 : TODO
}
c010022a:	90                   	nop
c010022b:	5d                   	pop    %ebp
c010022c:	c3                   	ret    

c010022d <lab1_switch_to_kernel>:

static void
lab1_switch_to_kernel(void) {
c010022d:	f3 0f 1e fb          	endbr32 
c0100231:	55                   	push   %ebp
c0100232:	89 e5                	mov    %esp,%ebp
    //LAB1 CHALLENGE 1 :  TODO
}
c0100234:	90                   	nop
c0100235:	5d                   	pop    %ebp
c0100236:	c3                   	ret    

c0100237 <lab1_switch_test>:

static void
lab1_switch_test(void) {
c0100237:	f3 0f 1e fb          	endbr32 
c010023b:	55                   	push   %ebp
c010023c:	89 e5                	mov    %esp,%ebp
c010023e:	83 ec 18             	sub    $0x18,%esp
    lab1_print_cur_status();
c0100241:	e8 1b ff ff ff       	call   c0100161 <lab1_print_cur_status>
    cprintf("+++ switch to  user  mode +++\n");
c0100246:	c7 04 24 e8 a0 10 c0 	movl   $0xc010a0e8,(%esp)
c010024d:	e8 7f 00 00 00       	call   c01002d1 <cprintf>
    lab1_switch_to_user();
c0100252:	e8 cc ff ff ff       	call   c0100223 <lab1_switch_to_user>
    lab1_print_cur_status();
c0100257:	e8 05 ff ff ff       	call   c0100161 <lab1_print_cur_status>
    cprintf("+++ switch to kernel mode +++\n");
c010025c:	c7 04 24 08 a1 10 c0 	movl   $0xc010a108,(%esp)
c0100263:	e8 69 00 00 00       	call   c01002d1 <cprintf>
    lab1_switch_to_kernel();
c0100268:	e8 c0 ff ff ff       	call   c010022d <lab1_switch_to_kernel>
    lab1_print_cur_status();
c010026d:	e8 ef fe ff ff       	call   c0100161 <lab1_print_cur_status>
}
c0100272:	90                   	nop
c0100273:	c9                   	leave  
c0100274:	c3                   	ret    

c0100275 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void
cputch(int c, int *cnt) {
c0100275:	f3 0f 1e fb          	endbr32 
c0100279:	55                   	push   %ebp
c010027a:	89 e5                	mov    %esp,%ebp
c010027c:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c010027f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100282:	89 04 24             	mov    %eax,(%esp)
c0100285:	e8 22 1c 00 00       	call   c0101eac <cons_putc>
    (*cnt) ++;
c010028a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010028d:	8b 00                	mov    (%eax),%eax
c010028f:	8d 50 01             	lea    0x1(%eax),%edx
c0100292:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100295:	89 10                	mov    %edx,(%eax)
}
c0100297:	90                   	nop
c0100298:	c9                   	leave  
c0100299:	c3                   	ret    

c010029a <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int
vcprintf(const char *fmt, va_list ap) {
c010029a:	f3 0f 1e fb          	endbr32 
c010029e:	55                   	push   %ebp
c010029f:	89 e5                	mov    %esp,%ebp
c01002a1:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c01002a4:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)cputch, &cnt, fmt, ap);
c01002ab:	8b 45 0c             	mov    0xc(%ebp),%eax
c01002ae:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01002b2:	8b 45 08             	mov    0x8(%ebp),%eax
c01002b5:	89 44 24 08          	mov    %eax,0x8(%esp)
c01002b9:	8d 45 f4             	lea    -0xc(%ebp),%eax
c01002bc:	89 44 24 04          	mov    %eax,0x4(%esp)
c01002c0:	c7 04 24 75 02 10 c0 	movl   $0xc0100275,(%esp)
c01002c7:	e8 de 97 00 00       	call   c0109aaa <vprintfmt>
    return cnt;
c01002cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01002cf:	c9                   	leave  
c01002d0:	c3                   	ret    

c01002d1 <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int
cprintf(const char *fmt, ...) {
c01002d1:	f3 0f 1e fb          	endbr32 
c01002d5:	55                   	push   %ebp
c01002d6:	89 e5                	mov    %esp,%ebp
c01002d8:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c01002db:	8d 45 0c             	lea    0xc(%ebp),%eax
c01002de:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vcprintf(fmt, ap);
c01002e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01002e4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01002e8:	8b 45 08             	mov    0x8(%ebp),%eax
c01002eb:	89 04 24             	mov    %eax,(%esp)
c01002ee:	e8 a7 ff ff ff       	call   c010029a <vcprintf>
c01002f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c01002f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01002f9:	c9                   	leave  
c01002fa:	c3                   	ret    

c01002fb <cputchar>:

/* cputchar - writes a single character to stdout */
void
cputchar(int c) {
c01002fb:	f3 0f 1e fb          	endbr32 
c01002ff:	55                   	push   %ebp
c0100300:	89 e5                	mov    %esp,%ebp
c0100302:	83 ec 18             	sub    $0x18,%esp
    cons_putc(c);
c0100305:	8b 45 08             	mov    0x8(%ebp),%eax
c0100308:	89 04 24             	mov    %eax,(%esp)
c010030b:	e8 9c 1b 00 00       	call   c0101eac <cons_putc>
}
c0100310:	90                   	nop
c0100311:	c9                   	leave  
c0100312:	c3                   	ret    

c0100313 <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int
cputs(const char *str) {
c0100313:	f3 0f 1e fb          	endbr32 
c0100317:	55                   	push   %ebp
c0100318:	89 e5                	mov    %esp,%ebp
c010031a:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
c010031d:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    char c;
    while ((c = *str ++) != '\0') {
c0100324:	eb 13                	jmp    c0100339 <cputs+0x26>
        cputch(c, &cnt);
c0100326:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c010032a:	8d 55 f0             	lea    -0x10(%ebp),%edx
c010032d:	89 54 24 04          	mov    %edx,0x4(%esp)
c0100331:	89 04 24             	mov    %eax,(%esp)
c0100334:	e8 3c ff ff ff       	call   c0100275 <cputch>
    while ((c = *str ++) != '\0') {
c0100339:	8b 45 08             	mov    0x8(%ebp),%eax
c010033c:	8d 50 01             	lea    0x1(%eax),%edx
c010033f:	89 55 08             	mov    %edx,0x8(%ebp)
c0100342:	0f b6 00             	movzbl (%eax),%eax
c0100345:	88 45 f7             	mov    %al,-0x9(%ebp)
c0100348:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
c010034c:	75 d8                	jne    c0100326 <cputs+0x13>
    }
    cputch('\n', &cnt);
c010034e:	8d 45 f0             	lea    -0x10(%ebp),%eax
c0100351:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100355:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
c010035c:	e8 14 ff ff ff       	call   c0100275 <cputch>
    return cnt;
c0100361:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0100364:	c9                   	leave  
c0100365:	c3                   	ret    

c0100366 <getchar>:

/* getchar - reads a single non-zero character from stdin */
int
getchar(void) {
c0100366:	f3 0f 1e fb          	endbr32 
c010036a:	55                   	push   %ebp
c010036b:	89 e5                	mov    %esp,%ebp
c010036d:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = cons_getc()) == 0)
c0100370:	90                   	nop
c0100371:	e8 77 1b 00 00       	call   c0101eed <cons_getc>
c0100376:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100379:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010037d:	74 f2                	je     c0100371 <getchar+0xb>
        /* do nothing */;
    return c;
c010037f:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100382:	c9                   	leave  
c0100383:	c3                   	ret    

c0100384 <readline>:
 * The readline() function returns the text of the line read. If some errors
 * are happened, NULL is returned. The return value is a global variable,
 * thus it should be copied before it is used.
 * */
char *
readline(const char *prompt) {
c0100384:	f3 0f 1e fb          	endbr32 
c0100388:	55                   	push   %ebp
c0100389:	89 e5                	mov    %esp,%ebp
c010038b:	83 ec 28             	sub    $0x28,%esp
    if (prompt != NULL) {
c010038e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100392:	74 13                	je     c01003a7 <readline+0x23>
        cprintf("%s", prompt);
c0100394:	8b 45 08             	mov    0x8(%ebp),%eax
c0100397:	89 44 24 04          	mov    %eax,0x4(%esp)
c010039b:	c7 04 24 27 a1 10 c0 	movl   $0xc010a127,(%esp)
c01003a2:	e8 2a ff ff ff       	call   c01002d1 <cprintf>
    }
    int i = 0, c;
c01003a7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        c = getchar();
c01003ae:	e8 b3 ff ff ff       	call   c0100366 <getchar>
c01003b3:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (c < 0) {
c01003b6:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01003ba:	79 07                	jns    c01003c3 <readline+0x3f>
            return NULL;
c01003bc:	b8 00 00 00 00       	mov    $0x0,%eax
c01003c1:	eb 78                	jmp    c010043b <readline+0xb7>
        }
        else if (c >= ' ' && i < BUFSIZE - 1) {
c01003c3:	83 7d f0 1f          	cmpl   $0x1f,-0x10(%ebp)
c01003c7:	7e 28                	jle    c01003f1 <readline+0x6d>
c01003c9:	81 7d f4 fe 03 00 00 	cmpl   $0x3fe,-0xc(%ebp)
c01003d0:	7f 1f                	jg     c01003f1 <readline+0x6d>
            cputchar(c);
c01003d2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01003d5:	89 04 24             	mov    %eax,(%esp)
c01003d8:	e8 1e ff ff ff       	call   c01002fb <cputchar>
            buf[i ++] = c;
c01003dd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01003e0:	8d 50 01             	lea    0x1(%eax),%edx
c01003e3:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01003e6:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01003e9:	88 90 20 b0 12 c0    	mov    %dl,-0x3fed4fe0(%eax)
c01003ef:	eb 45                	jmp    c0100436 <readline+0xb2>
        }
        else if (c == '\b' && i > 0) {
c01003f1:	83 7d f0 08          	cmpl   $0x8,-0x10(%ebp)
c01003f5:	75 16                	jne    c010040d <readline+0x89>
c01003f7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01003fb:	7e 10                	jle    c010040d <readline+0x89>
            cputchar(c);
c01003fd:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100400:	89 04 24             	mov    %eax,(%esp)
c0100403:	e8 f3 fe ff ff       	call   c01002fb <cputchar>
            i --;
c0100408:	ff 4d f4             	decl   -0xc(%ebp)
c010040b:	eb 29                	jmp    c0100436 <readline+0xb2>
        }
        else if (c == '\n' || c == '\r') {
c010040d:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
c0100411:	74 06                	je     c0100419 <readline+0x95>
c0100413:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
c0100417:	75 95                	jne    c01003ae <readline+0x2a>
            cputchar(c);
c0100419:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010041c:	89 04 24             	mov    %eax,(%esp)
c010041f:	e8 d7 fe ff ff       	call   c01002fb <cputchar>
            buf[i] = '\0';
c0100424:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100427:	05 20 b0 12 c0       	add    $0xc012b020,%eax
c010042c:	c6 00 00             	movb   $0x0,(%eax)
            return buf;
c010042f:	b8 20 b0 12 c0       	mov    $0xc012b020,%eax
c0100434:	eb 05                	jmp    c010043b <readline+0xb7>
        c = getchar();
c0100436:	e9 73 ff ff ff       	jmp    c01003ae <readline+0x2a>
        }
    }
}
c010043b:	c9                   	leave  
c010043c:	c3                   	ret    

c010043d <__panic>:
/* *
 * __panic - __panic is called on unresolvable fatal errors. it prints
 * "panic: 'message'", and then enters the kernel monitor.
 * */
void
__panic(const char *file, int line, const char *fmt, ...) {
c010043d:	f3 0f 1e fb          	endbr32 
c0100441:	55                   	push   %ebp
c0100442:	89 e5                	mov    %esp,%ebp
c0100444:	83 ec 28             	sub    $0x28,%esp
    if (is_panic) {
c0100447:	a1 20 b4 12 c0       	mov    0xc012b420,%eax
c010044c:	85 c0                	test   %eax,%eax
c010044e:	75 5b                	jne    c01004ab <__panic+0x6e>
        goto panic_dead;
    }
    is_panic = 1;
c0100450:	c7 05 20 b4 12 c0 01 	movl   $0x1,0xc012b420
c0100457:	00 00 00 

    // print the 'message'
    va_list ap;
    va_start(ap, fmt);
c010045a:	8d 45 14             	lea    0x14(%ebp),%eax
c010045d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel panic at %s:%d:\n    ", file, line);
c0100460:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100463:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100467:	8b 45 08             	mov    0x8(%ebp),%eax
c010046a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010046e:	c7 04 24 2a a1 10 c0 	movl   $0xc010a12a,(%esp)
c0100475:	e8 57 fe ff ff       	call   c01002d1 <cprintf>
    vcprintf(fmt, ap);
c010047a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010047d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100481:	8b 45 10             	mov    0x10(%ebp),%eax
c0100484:	89 04 24             	mov    %eax,(%esp)
c0100487:	e8 0e fe ff ff       	call   c010029a <vcprintf>
    cprintf("\n");
c010048c:	c7 04 24 46 a1 10 c0 	movl   $0xc010a146,(%esp)
c0100493:	e8 39 fe ff ff       	call   c01002d1 <cprintf>
    
    cprintf("stack trackback:\n");
c0100498:	c7 04 24 48 a1 10 c0 	movl   $0xc010a148,(%esp)
c010049f:	e8 2d fe ff ff       	call   c01002d1 <cprintf>
    print_stackframe();
c01004a4:	e8 3d 06 00 00       	call   c0100ae6 <print_stackframe>
c01004a9:	eb 01                	jmp    c01004ac <__panic+0x6f>
        goto panic_dead;
c01004ab:	90                   	nop
    
    va_end(ap);

panic_dead:
    intr_disable();
c01004ac:	e8 9d 1c 00 00       	call   c010214e <intr_disable>
    while (1) {
        kmonitor(NULL);
c01004b1:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c01004b8:	e8 a7 07 00 00       	call   c0100c64 <kmonitor>
c01004bd:	eb f2                	jmp    c01004b1 <__panic+0x74>

c01004bf <__warn>:
    }
}

/* __warn - like panic, but don't */
void
__warn(const char *file, int line, const char *fmt, ...) {
c01004bf:	f3 0f 1e fb          	endbr32 
c01004c3:	55                   	push   %ebp
c01004c4:	89 e5                	mov    %esp,%ebp
c01004c6:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    va_start(ap, fmt);
c01004c9:	8d 45 14             	lea    0x14(%ebp),%eax
c01004cc:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("kernel warning at %s:%d:\n    ", file, line);
c01004cf:	8b 45 0c             	mov    0xc(%ebp),%eax
c01004d2:	89 44 24 08          	mov    %eax,0x8(%esp)
c01004d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01004d9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01004dd:	c7 04 24 5a a1 10 c0 	movl   $0xc010a15a,(%esp)
c01004e4:	e8 e8 fd ff ff       	call   c01002d1 <cprintf>
    vcprintf(fmt, ap);
c01004e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01004ec:	89 44 24 04          	mov    %eax,0x4(%esp)
c01004f0:	8b 45 10             	mov    0x10(%ebp),%eax
c01004f3:	89 04 24             	mov    %eax,(%esp)
c01004f6:	e8 9f fd ff ff       	call   c010029a <vcprintf>
    cprintf("\n");
c01004fb:	c7 04 24 46 a1 10 c0 	movl   $0xc010a146,(%esp)
c0100502:	e8 ca fd ff ff       	call   c01002d1 <cprintf>
    va_end(ap);
}
c0100507:	90                   	nop
c0100508:	c9                   	leave  
c0100509:	c3                   	ret    

c010050a <is_kernel_panic>:

bool
is_kernel_panic(void) {
c010050a:	f3 0f 1e fb          	endbr32 
c010050e:	55                   	push   %ebp
c010050f:	89 e5                	mov    %esp,%ebp
    return is_panic;
c0100511:	a1 20 b4 12 c0       	mov    0xc012b420,%eax
}
c0100516:	5d                   	pop    %ebp
c0100517:	c3                   	ret    

c0100518 <stab_binsearch>:
 *      stab_binsearch(stabs, &left, &right, N_SO, 0xf0100184);
 * will exit setting left = 118, right = 554.
 * */
static void
stab_binsearch(const struct stab *stabs, int *region_left, int *region_right,
           int type, uintptr_t addr) {
c0100518:	f3 0f 1e fb          	endbr32 
c010051c:	55                   	push   %ebp
c010051d:	89 e5                	mov    %esp,%ebp
c010051f:	83 ec 20             	sub    $0x20,%esp
    int l = *region_left, r = *region_right, any_matches = 0;
c0100522:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100525:	8b 00                	mov    (%eax),%eax
c0100527:	89 45 fc             	mov    %eax,-0x4(%ebp)
c010052a:	8b 45 10             	mov    0x10(%ebp),%eax
c010052d:	8b 00                	mov    (%eax),%eax
c010052f:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0100532:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

    while (l <= r) {
c0100539:	e9 ca 00 00 00       	jmp    c0100608 <stab_binsearch+0xf0>
        int true_m = (l + r) / 2, m = true_m;
c010053e:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100541:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0100544:	01 d0                	add    %edx,%eax
c0100546:	89 c2                	mov    %eax,%edx
c0100548:	c1 ea 1f             	shr    $0x1f,%edx
c010054b:	01 d0                	add    %edx,%eax
c010054d:	d1 f8                	sar    %eax
c010054f:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0100552:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100555:	89 45 f0             	mov    %eax,-0x10(%ebp)

        // search for earliest stab with right type
        while (m >= l && stabs[m].n_type != type) {
c0100558:	eb 03                	jmp    c010055d <stab_binsearch+0x45>
            m --;
c010055a:	ff 4d f0             	decl   -0x10(%ebp)
        while (m >= l && stabs[m].n_type != type) {
c010055d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100560:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c0100563:	7c 1f                	jl     c0100584 <stab_binsearch+0x6c>
c0100565:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0100568:	89 d0                	mov    %edx,%eax
c010056a:	01 c0                	add    %eax,%eax
c010056c:	01 d0                	add    %edx,%eax
c010056e:	c1 e0 02             	shl    $0x2,%eax
c0100571:	89 c2                	mov    %eax,%edx
c0100573:	8b 45 08             	mov    0x8(%ebp),%eax
c0100576:	01 d0                	add    %edx,%eax
c0100578:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c010057c:	0f b6 c0             	movzbl %al,%eax
c010057f:	39 45 14             	cmp    %eax,0x14(%ebp)
c0100582:	75 d6                	jne    c010055a <stab_binsearch+0x42>
        }
        if (m < l) {    // no match in [l, m]
c0100584:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100587:	3b 45 fc             	cmp    -0x4(%ebp),%eax
c010058a:	7d 09                	jge    c0100595 <stab_binsearch+0x7d>
            l = true_m + 1;
c010058c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010058f:	40                   	inc    %eax
c0100590:	89 45 fc             	mov    %eax,-0x4(%ebp)
            continue;
c0100593:	eb 73                	jmp    c0100608 <stab_binsearch+0xf0>
        }

        // actual binary search
        any_matches = 1;
c0100595:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
        if (stabs[m].n_value < addr) {
c010059c:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010059f:	89 d0                	mov    %edx,%eax
c01005a1:	01 c0                	add    %eax,%eax
c01005a3:	01 d0                	add    %edx,%eax
c01005a5:	c1 e0 02             	shl    $0x2,%eax
c01005a8:	89 c2                	mov    %eax,%edx
c01005aa:	8b 45 08             	mov    0x8(%ebp),%eax
c01005ad:	01 d0                	add    %edx,%eax
c01005af:	8b 40 08             	mov    0x8(%eax),%eax
c01005b2:	39 45 18             	cmp    %eax,0x18(%ebp)
c01005b5:	76 11                	jbe    c01005c8 <stab_binsearch+0xb0>
            *region_left = m;
c01005b7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01005ba:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005bd:	89 10                	mov    %edx,(%eax)
            l = true_m + 1;
c01005bf:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01005c2:	40                   	inc    %eax
c01005c3:	89 45 fc             	mov    %eax,-0x4(%ebp)
c01005c6:	eb 40                	jmp    c0100608 <stab_binsearch+0xf0>
        } else if (stabs[m].n_value > addr) {
c01005c8:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005cb:	89 d0                	mov    %edx,%eax
c01005cd:	01 c0                	add    %eax,%eax
c01005cf:	01 d0                	add    %edx,%eax
c01005d1:	c1 e0 02             	shl    $0x2,%eax
c01005d4:	89 c2                	mov    %eax,%edx
c01005d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01005d9:	01 d0                	add    %edx,%eax
c01005db:	8b 40 08             	mov    0x8(%eax),%eax
c01005de:	39 45 18             	cmp    %eax,0x18(%ebp)
c01005e1:	73 14                	jae    c01005f7 <stab_binsearch+0xdf>
            *region_right = m - 1;
c01005e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005e6:	8d 50 ff             	lea    -0x1(%eax),%edx
c01005e9:	8b 45 10             	mov    0x10(%ebp),%eax
c01005ec:	89 10                	mov    %edx,(%eax)
            r = m - 1;
c01005ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01005f1:	48                   	dec    %eax
c01005f2:	89 45 f8             	mov    %eax,-0x8(%ebp)
c01005f5:	eb 11                	jmp    c0100608 <stab_binsearch+0xf0>
        } else {
            // exact match for 'addr', but continue loop to find
            // *region_right
            *region_left = m;
c01005f7:	8b 45 0c             	mov    0xc(%ebp),%eax
c01005fa:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01005fd:	89 10                	mov    %edx,(%eax)
            l = m;
c01005ff:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100602:	89 45 fc             	mov    %eax,-0x4(%ebp)
            addr ++;
c0100605:	ff 45 18             	incl   0x18(%ebp)
    while (l <= r) {
c0100608:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010060b:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c010060e:	0f 8e 2a ff ff ff    	jle    c010053e <stab_binsearch+0x26>
        }
    }

    if (!any_matches) {
c0100614:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100618:	75 0f                	jne    c0100629 <stab_binsearch+0x111>
        *region_right = *region_left - 1;
c010061a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010061d:	8b 00                	mov    (%eax),%eax
c010061f:	8d 50 ff             	lea    -0x1(%eax),%edx
c0100622:	8b 45 10             	mov    0x10(%ebp),%eax
c0100625:	89 10                	mov    %edx,(%eax)
        l = *region_right;
        for (; l > *region_left && stabs[l].n_type != type; l --)
            /* do nothing */;
        *region_left = l;
    }
}
c0100627:	eb 3e                	jmp    c0100667 <stab_binsearch+0x14f>
        l = *region_right;
c0100629:	8b 45 10             	mov    0x10(%ebp),%eax
c010062c:	8b 00                	mov    (%eax),%eax
c010062e:	89 45 fc             	mov    %eax,-0x4(%ebp)
        for (; l > *region_left && stabs[l].n_type != type; l --)
c0100631:	eb 03                	jmp    c0100636 <stab_binsearch+0x11e>
c0100633:	ff 4d fc             	decl   -0x4(%ebp)
c0100636:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100639:	8b 00                	mov    (%eax),%eax
c010063b:	39 45 fc             	cmp    %eax,-0x4(%ebp)
c010063e:	7e 1f                	jle    c010065f <stab_binsearch+0x147>
c0100640:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100643:	89 d0                	mov    %edx,%eax
c0100645:	01 c0                	add    %eax,%eax
c0100647:	01 d0                	add    %edx,%eax
c0100649:	c1 e0 02             	shl    $0x2,%eax
c010064c:	89 c2                	mov    %eax,%edx
c010064e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100651:	01 d0                	add    %edx,%eax
c0100653:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100657:	0f b6 c0             	movzbl %al,%eax
c010065a:	39 45 14             	cmp    %eax,0x14(%ebp)
c010065d:	75 d4                	jne    c0100633 <stab_binsearch+0x11b>
        *region_left = l;
c010065f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100662:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0100665:	89 10                	mov    %edx,(%eax)
}
c0100667:	90                   	nop
c0100668:	c9                   	leave  
c0100669:	c3                   	ret    

c010066a <debuginfo_eip>:
 * the specified instruction address, @addr.  Returns 0 if information
 * was found, and negative if not.  But even if it returns negative it
 * has stored some information into '*info'.
 * */
int
debuginfo_eip(uintptr_t addr, struct eipdebuginfo *info) {
c010066a:	f3 0f 1e fb          	endbr32 
c010066e:	55                   	push   %ebp
c010066f:	89 e5                	mov    %esp,%ebp
c0100671:	83 ec 58             	sub    $0x58,%esp
    const struct stab *stabs, *stab_end;
    const char *stabstr, *stabstr_end;

    info->eip_file = "<unknown>";
c0100674:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100677:	c7 00 78 a1 10 c0    	movl   $0xc010a178,(%eax)
    info->eip_line = 0;
c010067d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100680:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    info->eip_fn_name = "<unknown>";
c0100687:	8b 45 0c             	mov    0xc(%ebp),%eax
c010068a:	c7 40 08 78 a1 10 c0 	movl   $0xc010a178,0x8(%eax)
    info->eip_fn_namelen = 9;
c0100691:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100694:	c7 40 0c 09 00 00 00 	movl   $0x9,0xc(%eax)
    info->eip_fn_addr = addr;
c010069b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010069e:	8b 55 08             	mov    0x8(%ebp),%edx
c01006a1:	89 50 10             	mov    %edx,0x10(%eax)
    info->eip_fn_narg = 0;
c01006a4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01006a7:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)

    stabs = __STAB_BEGIN__;
c01006ae:	c7 45 f4 d8 c3 10 c0 	movl   $0xc010c3d8,-0xc(%ebp)
    stab_end = __STAB_END__;
c01006b5:	c7 45 f0 68 0b 12 c0 	movl   $0xc0120b68,-0x10(%ebp)
    stabstr = __STABSTR_BEGIN__;
c01006bc:	c7 45 ec 69 0b 12 c0 	movl   $0xc0120b69,-0x14(%ebp)
    stabstr_end = __STABSTR_END__;
c01006c3:	c7 45 e8 45 54 12 c0 	movl   $0xc0125445,-0x18(%ebp)

    // String table validity checks
    if (stabstr_end <= stabstr || stabstr_end[-1] != 0) {
c01006ca:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01006cd:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01006d0:	76 0b                	jbe    c01006dd <debuginfo_eip+0x73>
c01006d2:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01006d5:	48                   	dec    %eax
c01006d6:	0f b6 00             	movzbl (%eax),%eax
c01006d9:	84 c0                	test   %al,%al
c01006db:	74 0a                	je     c01006e7 <debuginfo_eip+0x7d>
        return -1;
c01006dd:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c01006e2:	e9 ab 02 00 00       	jmp    c0100992 <debuginfo_eip+0x328>
    // 'eip'.  First, we find the basic source file containing 'eip'.
    // Then, we look in that source file for the function.  Then we look
    // for the line number.

    // Search the entire set of stabs for the source file (type N_SO).
    int lfile = 0, rfile = (stab_end - stabs) - 1;
c01006e7:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
c01006ee:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01006f1:	2b 45 f4             	sub    -0xc(%ebp),%eax
c01006f4:	c1 f8 02             	sar    $0x2,%eax
c01006f7:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
c01006fd:	48                   	dec    %eax
c01006fe:	89 45 e0             	mov    %eax,-0x20(%ebp)
    stab_binsearch(stabs, &lfile, &rfile, N_SO, addr);
c0100701:	8b 45 08             	mov    0x8(%ebp),%eax
c0100704:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100708:	c7 44 24 0c 64 00 00 	movl   $0x64,0xc(%esp)
c010070f:	00 
c0100710:	8d 45 e0             	lea    -0x20(%ebp),%eax
c0100713:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100717:	8d 45 e4             	lea    -0x1c(%ebp),%eax
c010071a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010071e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100721:	89 04 24             	mov    %eax,(%esp)
c0100724:	e8 ef fd ff ff       	call   c0100518 <stab_binsearch>
    if (lfile == 0)
c0100729:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010072c:	85 c0                	test   %eax,%eax
c010072e:	75 0a                	jne    c010073a <debuginfo_eip+0xd0>
        return -1;
c0100730:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100735:	e9 58 02 00 00       	jmp    c0100992 <debuginfo_eip+0x328>

    // Search within that file's stabs for the function definition
    // (N_FUN).
    int lfun = lfile, rfun = rfile;
c010073a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010073d:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0100740:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100743:	89 45 d8             	mov    %eax,-0x28(%ebp)
    int lline, rline;
    stab_binsearch(stabs, &lfun, &rfun, N_FUN, addr);
c0100746:	8b 45 08             	mov    0x8(%ebp),%eax
c0100749:	89 44 24 10          	mov    %eax,0x10(%esp)
c010074d:	c7 44 24 0c 24 00 00 	movl   $0x24,0xc(%esp)
c0100754:	00 
c0100755:	8d 45 d8             	lea    -0x28(%ebp),%eax
c0100758:	89 44 24 08          	mov    %eax,0x8(%esp)
c010075c:	8d 45 dc             	lea    -0x24(%ebp),%eax
c010075f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100763:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100766:	89 04 24             	mov    %eax,(%esp)
c0100769:	e8 aa fd ff ff       	call   c0100518 <stab_binsearch>

    if (lfun <= rfun) {
c010076e:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0100771:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100774:	39 c2                	cmp    %eax,%edx
c0100776:	7f 78                	jg     c01007f0 <debuginfo_eip+0x186>
        // stabs[lfun] points to the function name
        // in the string table, but check bounds just in case.
        if (stabs[lfun].n_strx < stabstr_end - stabstr) {
c0100778:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010077b:	89 c2                	mov    %eax,%edx
c010077d:	89 d0                	mov    %edx,%eax
c010077f:	01 c0                	add    %eax,%eax
c0100781:	01 d0                	add    %edx,%eax
c0100783:	c1 e0 02             	shl    $0x2,%eax
c0100786:	89 c2                	mov    %eax,%edx
c0100788:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010078b:	01 d0                	add    %edx,%eax
c010078d:	8b 10                	mov    (%eax),%edx
c010078f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100792:	2b 45 ec             	sub    -0x14(%ebp),%eax
c0100795:	39 c2                	cmp    %eax,%edx
c0100797:	73 22                	jae    c01007bb <debuginfo_eip+0x151>
            info->eip_fn_name = stabstr + stabs[lfun].n_strx;
c0100799:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010079c:	89 c2                	mov    %eax,%edx
c010079e:	89 d0                	mov    %edx,%eax
c01007a0:	01 c0                	add    %eax,%eax
c01007a2:	01 d0                	add    %edx,%eax
c01007a4:	c1 e0 02             	shl    $0x2,%eax
c01007a7:	89 c2                	mov    %eax,%edx
c01007a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007ac:	01 d0                	add    %edx,%eax
c01007ae:	8b 10                	mov    (%eax),%edx
c01007b0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01007b3:	01 c2                	add    %eax,%edx
c01007b5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007b8:	89 50 08             	mov    %edx,0x8(%eax)
        }
        info->eip_fn_addr = stabs[lfun].n_value;
c01007bb:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01007be:	89 c2                	mov    %eax,%edx
c01007c0:	89 d0                	mov    %edx,%eax
c01007c2:	01 c0                	add    %eax,%eax
c01007c4:	01 d0                	add    %edx,%eax
c01007c6:	c1 e0 02             	shl    $0x2,%eax
c01007c9:	89 c2                	mov    %eax,%edx
c01007cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01007ce:	01 d0                	add    %edx,%eax
c01007d0:	8b 50 08             	mov    0x8(%eax),%edx
c01007d3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007d6:	89 50 10             	mov    %edx,0x10(%eax)
        addr -= info->eip_fn_addr;
c01007d9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007dc:	8b 40 10             	mov    0x10(%eax),%eax
c01007df:	29 45 08             	sub    %eax,0x8(%ebp)
        // Search within the function definition for the line number.
        lline = lfun;
c01007e2:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01007e5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfun;
c01007e8:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01007eb:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01007ee:	eb 15                	jmp    c0100805 <debuginfo_eip+0x19b>
    } else {
        // Couldn't find function stab!  Maybe we're in an assembly
        // file.  Search the whole file for the line number.
        info->eip_fn_addr = addr;
c01007f0:	8b 45 0c             	mov    0xc(%ebp),%eax
c01007f3:	8b 55 08             	mov    0x8(%ebp),%edx
c01007f6:	89 50 10             	mov    %edx,0x10(%eax)
        lline = lfile;
c01007f9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01007fc:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        rline = rfile;
c01007ff:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100802:	89 45 d0             	mov    %eax,-0x30(%ebp)
    }
    info->eip_fn_namelen = strfind(info->eip_fn_name, ':') - info->eip_fn_name;
c0100805:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100808:	8b 40 08             	mov    0x8(%eax),%eax
c010080b:	c7 44 24 04 3a 00 00 	movl   $0x3a,0x4(%esp)
c0100812:	00 
c0100813:	89 04 24             	mov    %eax,(%esp)
c0100816:	e8 97 8d 00 00       	call   c01095b2 <strfind>
c010081b:	8b 55 0c             	mov    0xc(%ebp),%edx
c010081e:	8b 52 08             	mov    0x8(%edx),%edx
c0100821:	29 d0                	sub    %edx,%eax
c0100823:	89 c2                	mov    %eax,%edx
c0100825:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100828:	89 50 0c             	mov    %edx,0xc(%eax)

    // Search within [lline, rline] for the line number stab.
    // If found, set info->eip_line to the right line number.
    // If not found, return -1.
    stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
c010082b:	8b 45 08             	mov    0x8(%ebp),%eax
c010082e:	89 44 24 10          	mov    %eax,0x10(%esp)
c0100832:	c7 44 24 0c 44 00 00 	movl   $0x44,0xc(%esp)
c0100839:	00 
c010083a:	8d 45 d0             	lea    -0x30(%ebp),%eax
c010083d:	89 44 24 08          	mov    %eax,0x8(%esp)
c0100841:	8d 45 d4             	lea    -0x2c(%ebp),%eax
c0100844:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100848:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010084b:	89 04 24             	mov    %eax,(%esp)
c010084e:	e8 c5 fc ff ff       	call   c0100518 <stab_binsearch>
    if (lline <= rline) {
c0100853:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100856:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100859:	39 c2                	cmp    %eax,%edx
c010085b:	7f 23                	jg     c0100880 <debuginfo_eip+0x216>
        info->eip_line = stabs[rline].n_desc;
c010085d:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0100860:	89 c2                	mov    %eax,%edx
c0100862:	89 d0                	mov    %edx,%eax
c0100864:	01 c0                	add    %eax,%eax
c0100866:	01 d0                	add    %edx,%eax
c0100868:	c1 e0 02             	shl    $0x2,%eax
c010086b:	89 c2                	mov    %eax,%edx
c010086d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100870:	01 d0                	add    %edx,%eax
c0100872:	0f b7 40 06          	movzwl 0x6(%eax),%eax
c0100876:	89 c2                	mov    %eax,%edx
c0100878:	8b 45 0c             	mov    0xc(%ebp),%eax
c010087b:	89 50 04             	mov    %edx,0x4(%eax)

    // Search backwards from the line number for the relevant filename stab.
    // We can't just use the "lfile" stab because inlined functions
    // can interpolate code from a different file!
    // Such included source files use the N_SOL stab type.
    while (lline >= lfile
c010087e:	eb 11                	jmp    c0100891 <debuginfo_eip+0x227>
        return -1;
c0100880:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100885:	e9 08 01 00 00       	jmp    c0100992 <debuginfo_eip+0x328>
           && stabs[lline].n_type != N_SOL
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
        lline --;
c010088a:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010088d:	48                   	dec    %eax
c010088e:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    while (lline >= lfile
c0100891:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100894:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100897:	39 c2                	cmp    %eax,%edx
c0100899:	7c 56                	jl     c01008f1 <debuginfo_eip+0x287>
           && stabs[lline].n_type != N_SOL
c010089b:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010089e:	89 c2                	mov    %eax,%edx
c01008a0:	89 d0                	mov    %edx,%eax
c01008a2:	01 c0                	add    %eax,%eax
c01008a4:	01 d0                	add    %edx,%eax
c01008a6:	c1 e0 02             	shl    $0x2,%eax
c01008a9:	89 c2                	mov    %eax,%edx
c01008ab:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008ae:	01 d0                	add    %edx,%eax
c01008b0:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01008b4:	3c 84                	cmp    $0x84,%al
c01008b6:	74 39                	je     c01008f1 <debuginfo_eip+0x287>
           && (stabs[lline].n_type != N_SO || !stabs[lline].n_value)) {
c01008b8:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01008bb:	89 c2                	mov    %eax,%edx
c01008bd:	89 d0                	mov    %edx,%eax
c01008bf:	01 c0                	add    %eax,%eax
c01008c1:	01 d0                	add    %edx,%eax
c01008c3:	c1 e0 02             	shl    $0x2,%eax
c01008c6:	89 c2                	mov    %eax,%edx
c01008c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008cb:	01 d0                	add    %edx,%eax
c01008cd:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c01008d1:	3c 64                	cmp    $0x64,%al
c01008d3:	75 b5                	jne    c010088a <debuginfo_eip+0x220>
c01008d5:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01008d8:	89 c2                	mov    %eax,%edx
c01008da:	89 d0                	mov    %edx,%eax
c01008dc:	01 c0                	add    %eax,%eax
c01008de:	01 d0                	add    %edx,%eax
c01008e0:	c1 e0 02             	shl    $0x2,%eax
c01008e3:	89 c2                	mov    %eax,%edx
c01008e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01008e8:	01 d0                	add    %edx,%eax
c01008ea:	8b 40 08             	mov    0x8(%eax),%eax
c01008ed:	85 c0                	test   %eax,%eax
c01008ef:	74 99                	je     c010088a <debuginfo_eip+0x220>
    }
    if (lline >= lfile && stabs[lline].n_strx < stabstr_end - stabstr) {
c01008f1:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01008f4:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01008f7:	39 c2                	cmp    %eax,%edx
c01008f9:	7c 42                	jl     c010093d <debuginfo_eip+0x2d3>
c01008fb:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01008fe:	89 c2                	mov    %eax,%edx
c0100900:	89 d0                	mov    %edx,%eax
c0100902:	01 c0                	add    %eax,%eax
c0100904:	01 d0                	add    %edx,%eax
c0100906:	c1 e0 02             	shl    $0x2,%eax
c0100909:	89 c2                	mov    %eax,%edx
c010090b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010090e:	01 d0                	add    %edx,%eax
c0100910:	8b 10                	mov    (%eax),%edx
c0100912:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100915:	2b 45 ec             	sub    -0x14(%ebp),%eax
c0100918:	39 c2                	cmp    %eax,%edx
c010091a:	73 21                	jae    c010093d <debuginfo_eip+0x2d3>
        info->eip_file = stabstr + stabs[lline].n_strx;
c010091c:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010091f:	89 c2                	mov    %eax,%edx
c0100921:	89 d0                	mov    %edx,%eax
c0100923:	01 c0                	add    %eax,%eax
c0100925:	01 d0                	add    %edx,%eax
c0100927:	c1 e0 02             	shl    $0x2,%eax
c010092a:	89 c2                	mov    %eax,%edx
c010092c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010092f:	01 d0                	add    %edx,%eax
c0100931:	8b 10                	mov    (%eax),%edx
c0100933:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100936:	01 c2                	add    %eax,%edx
c0100938:	8b 45 0c             	mov    0xc(%ebp),%eax
c010093b:	89 10                	mov    %edx,(%eax)
    }

    // Set eip_fn_narg to the number of arguments taken by the function,
    // or 0 if there was no containing function.
    if (lfun < rfun) {
c010093d:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0100940:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100943:	39 c2                	cmp    %eax,%edx
c0100945:	7d 46                	jge    c010098d <debuginfo_eip+0x323>
        for (lline = lfun + 1;
c0100947:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010094a:	40                   	inc    %eax
c010094b:	89 45 d4             	mov    %eax,-0x2c(%ebp)
c010094e:	eb 16                	jmp    c0100966 <debuginfo_eip+0x2fc>
             lline < rfun && stabs[lline].n_type == N_PSYM;
             lline ++) {
            info->eip_fn_narg ++;
c0100950:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100953:	8b 40 14             	mov    0x14(%eax),%eax
c0100956:	8d 50 01             	lea    0x1(%eax),%edx
c0100959:	8b 45 0c             	mov    0xc(%ebp),%eax
c010095c:	89 50 14             	mov    %edx,0x14(%eax)
             lline ++) {
c010095f:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100962:	40                   	inc    %eax
c0100963:	89 45 d4             	mov    %eax,-0x2c(%ebp)
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100966:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0100969:	8b 45 d8             	mov    -0x28(%ebp),%eax
        for (lline = lfun + 1;
c010096c:	39 c2                	cmp    %eax,%edx
c010096e:	7d 1d                	jge    c010098d <debuginfo_eip+0x323>
             lline < rfun && stabs[lline].n_type == N_PSYM;
c0100970:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0100973:	89 c2                	mov    %eax,%edx
c0100975:	89 d0                	mov    %edx,%eax
c0100977:	01 c0                	add    %eax,%eax
c0100979:	01 d0                	add    %edx,%eax
c010097b:	c1 e0 02             	shl    $0x2,%eax
c010097e:	89 c2                	mov    %eax,%edx
c0100980:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100983:	01 d0                	add    %edx,%eax
c0100985:	0f b6 40 04          	movzbl 0x4(%eax),%eax
c0100989:	3c a0                	cmp    $0xa0,%al
c010098b:	74 c3                	je     c0100950 <debuginfo_eip+0x2e6>
        }
    }
    return 0;
c010098d:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100992:	c9                   	leave  
c0100993:	c3                   	ret    

c0100994 <print_kerninfo>:
 * print_kerninfo - print the information about kernel, including the location
 * of kernel entry, the start addresses of data and text segements, the start
 * address of free memory and how many memory that kernel has used.
 * */
void
print_kerninfo(void) {
c0100994:	f3 0f 1e fb          	endbr32 
c0100998:	55                   	push   %ebp
c0100999:	89 e5                	mov    %esp,%ebp
c010099b:	83 ec 18             	sub    $0x18,%esp
    extern char etext[], edata[], end[], kern_init[];
    cprintf("Special kernel symbols:\n");
c010099e:	c7 04 24 82 a1 10 c0 	movl   $0xc010a182,(%esp)
c01009a5:	e8 27 f9 ff ff       	call   c01002d1 <cprintf>
    cprintf("  entry  0x%08x (phys)\n", kern_init);
c01009aa:	c7 44 24 04 36 00 10 	movl   $0xc0100036,0x4(%esp)
c01009b1:	c0 
c01009b2:	c7 04 24 9b a1 10 c0 	movl   $0xc010a19b,(%esp)
c01009b9:	e8 13 f9 ff ff       	call   c01002d1 <cprintf>
    cprintf("  etext  0x%08x (phys)\n", etext);
c01009be:	c7 44 24 04 6b a0 10 	movl   $0xc010a06b,0x4(%esp)
c01009c5:	c0 
c01009c6:	c7 04 24 b3 a1 10 c0 	movl   $0xc010a1b3,(%esp)
c01009cd:	e8 ff f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("  edata  0x%08x (phys)\n", edata);
c01009d2:	c7 44 24 04 00 b0 12 	movl   $0xc012b000,0x4(%esp)
c01009d9:	c0 
c01009da:	c7 04 24 cb a1 10 c0 	movl   $0xc010a1cb,(%esp)
c01009e1:	e8 eb f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("  end    0x%08x (phys)\n", end);
c01009e6:	c7 44 24 04 4c e1 12 	movl   $0xc012e14c,0x4(%esp)
c01009ed:	c0 
c01009ee:	c7 04 24 e3 a1 10 c0 	movl   $0xc010a1e3,(%esp)
c01009f5:	e8 d7 f8 ff ff       	call   c01002d1 <cprintf>
    cprintf("Kernel executable memory footprint: %dKB\n", (end - kern_init + 1023)/1024);
c01009fa:	b8 4c e1 12 c0       	mov    $0xc012e14c,%eax
c01009ff:	2d 36 00 10 c0       	sub    $0xc0100036,%eax
c0100a04:	05 ff 03 00 00       	add    $0x3ff,%eax
c0100a09:	8d 90 ff 03 00 00    	lea    0x3ff(%eax),%edx
c0100a0f:	85 c0                	test   %eax,%eax
c0100a11:	0f 48 c2             	cmovs  %edx,%eax
c0100a14:	c1 f8 0a             	sar    $0xa,%eax
c0100a17:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a1b:	c7 04 24 fc a1 10 c0 	movl   $0xc010a1fc,(%esp)
c0100a22:	e8 aa f8 ff ff       	call   c01002d1 <cprintf>
}
c0100a27:	90                   	nop
c0100a28:	c9                   	leave  
c0100a29:	c3                   	ret    

c0100a2a <print_debuginfo>:
/* *
 * print_debuginfo - read and print the stat information for the address @eip,
 * and info.eip_fn_addr should be the first address of the related function.
 * */
void
print_debuginfo(uintptr_t eip) {
c0100a2a:	f3 0f 1e fb          	endbr32 
c0100a2e:	55                   	push   %ebp
c0100a2f:	89 e5                	mov    %esp,%ebp
c0100a31:	81 ec 48 01 00 00    	sub    $0x148,%esp
    struct eipdebuginfo info;
    if (debuginfo_eip(eip, &info) != 0) {
c0100a37:	8d 45 dc             	lea    -0x24(%ebp),%eax
c0100a3a:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a3e:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a41:	89 04 24             	mov    %eax,(%esp)
c0100a44:	e8 21 fc ff ff       	call   c010066a <debuginfo_eip>
c0100a49:	85 c0                	test   %eax,%eax
c0100a4b:	74 15                	je     c0100a62 <print_debuginfo+0x38>
        cprintf("    <unknow>: -- 0x%08x --\n", eip);
c0100a4d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100a50:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100a54:	c7 04 24 26 a2 10 c0 	movl   $0xc010a226,(%esp)
c0100a5b:	e8 71 f8 ff ff       	call   c01002d1 <cprintf>
        }
        fnname[j] = '\0';
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
                fnname, eip - info.eip_fn_addr);
    }
}
c0100a60:	eb 6c                	jmp    c0100ace <print_debuginfo+0xa4>
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100a62:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100a69:	eb 1b                	jmp    c0100a86 <print_debuginfo+0x5c>
            fnname[j] = info.eip_fn_name[j];
c0100a6b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0100a6e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a71:	01 d0                	add    %edx,%eax
c0100a73:	0f b6 10             	movzbl (%eax),%edx
c0100a76:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c0100a7c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a7f:	01 c8                	add    %ecx,%eax
c0100a81:	88 10                	mov    %dl,(%eax)
        for (j = 0; j < info.eip_fn_namelen; j ++) {
c0100a83:	ff 45 f4             	incl   -0xc(%ebp)
c0100a86:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0100a89:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0100a8c:	7c dd                	jl     c0100a6b <print_debuginfo+0x41>
        fnname[j] = '\0';
c0100a8e:	8d 95 dc fe ff ff    	lea    -0x124(%ebp),%edx
c0100a94:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100a97:	01 d0                	add    %edx,%eax
c0100a99:	c6 00 00             	movb   $0x0,(%eax)
                fnname, eip - info.eip_fn_addr);
c0100a9c:	8b 45 ec             	mov    -0x14(%ebp),%eax
        cprintf("    %s:%d: %s+%d\n", info.eip_file, info.eip_line,
c0100a9f:	8b 55 08             	mov    0x8(%ebp),%edx
c0100aa2:	89 d1                	mov    %edx,%ecx
c0100aa4:	29 c1                	sub    %eax,%ecx
c0100aa6:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0100aa9:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100aac:	89 4c 24 10          	mov    %ecx,0x10(%esp)
c0100ab0:	8d 8d dc fe ff ff    	lea    -0x124(%ebp),%ecx
c0100ab6:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0100aba:	89 54 24 08          	mov    %edx,0x8(%esp)
c0100abe:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100ac2:	c7 04 24 42 a2 10 c0 	movl   $0xc010a242,(%esp)
c0100ac9:	e8 03 f8 ff ff       	call   c01002d1 <cprintf>
}
c0100ace:	90                   	nop
c0100acf:	c9                   	leave  
c0100ad0:	c3                   	ret    

c0100ad1 <read_eip>:

static __noinline uint32_t
read_eip(void) {
c0100ad1:	f3 0f 1e fb          	endbr32 
c0100ad5:	55                   	push   %ebp
c0100ad6:	89 e5                	mov    %esp,%ebp
c0100ad8:	83 ec 10             	sub    $0x10,%esp
    uint32_t eip;
    asm volatile("movl 4(%%ebp), %0" : "=r" (eip));
c0100adb:	8b 45 04             	mov    0x4(%ebp),%eax
c0100ade:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return eip;
c0100ae1:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0100ae4:	c9                   	leave  
c0100ae5:	c3                   	ret    

c0100ae6 <print_stackframe>:
 *
 * Note that, the length of ebp-chain is limited. In boot/bootasm.S, before jumping
 * to the kernel entry, the value of ebp has been set to zero, that's the boundary.
 * */
void
print_stackframe(void) {
c0100ae6:	f3 0f 1e fb          	endbr32 
c0100aea:	55                   	push   %ebp
c0100aeb:	89 e5                	mov    %esp,%ebp
      *    (3.4) call print_debuginfo(eip-1) to print the C calling function name and line number, etc.
      *    (3.5) popup a calling stackframe
      *           NOTICE: the calling funciton's return addr eip  = ss:[ebp+4]
      *                   the calling funciton's ebp = ss:[ebp]
      */
}
c0100aed:	90                   	nop
c0100aee:	5d                   	pop    %ebp
c0100aef:	c3                   	ret    

c0100af0 <parse>:
#define MAXARGS         16
#define WHITESPACE      " \t\n\r"

/* parse - parse the command buffer into whitespace-separated arguments */
static int
parse(char *buf, char **argv) {
c0100af0:	f3 0f 1e fb          	endbr32 
c0100af4:	55                   	push   %ebp
c0100af5:	89 e5                	mov    %esp,%ebp
c0100af7:	83 ec 28             	sub    $0x28,%esp
    int argc = 0;
c0100afa:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (1) {
        // find global whitespace
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100b01:	eb 0c                	jmp    c0100b0f <parse+0x1f>
            *buf ++ = '\0';
c0100b03:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b06:	8d 50 01             	lea    0x1(%eax),%edx
c0100b09:	89 55 08             	mov    %edx,0x8(%ebp)
c0100b0c:	c6 00 00             	movb   $0x0,(%eax)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100b0f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b12:	0f b6 00             	movzbl (%eax),%eax
c0100b15:	84 c0                	test   %al,%al
c0100b17:	74 1d                	je     c0100b36 <parse+0x46>
c0100b19:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b1c:	0f b6 00             	movzbl (%eax),%eax
c0100b1f:	0f be c0             	movsbl %al,%eax
c0100b22:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b26:	c7 04 24 d4 a2 10 c0 	movl   $0xc010a2d4,(%esp)
c0100b2d:	e8 4a 8a 00 00       	call   c010957c <strchr>
c0100b32:	85 c0                	test   %eax,%eax
c0100b34:	75 cd                	jne    c0100b03 <parse+0x13>
        }
        if (*buf == '\0') {
c0100b36:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b39:	0f b6 00             	movzbl (%eax),%eax
c0100b3c:	84 c0                	test   %al,%al
c0100b3e:	74 65                	je     c0100ba5 <parse+0xb5>
            break;
        }

        // save and scan past next arg
        if (argc == MAXARGS - 1) {
c0100b40:	83 7d f4 0f          	cmpl   $0xf,-0xc(%ebp)
c0100b44:	75 14                	jne    c0100b5a <parse+0x6a>
            cprintf("Too many arguments (max %d).\n", MAXARGS);
c0100b46:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
c0100b4d:	00 
c0100b4e:	c7 04 24 d9 a2 10 c0 	movl   $0xc010a2d9,(%esp)
c0100b55:	e8 77 f7 ff ff       	call   c01002d1 <cprintf>
        }
        argv[argc ++] = buf;
c0100b5a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100b5d:	8d 50 01             	lea    0x1(%eax),%edx
c0100b60:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0100b63:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0100b6a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0100b6d:	01 c2                	add    %eax,%edx
c0100b6f:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b72:	89 02                	mov    %eax,(%edx)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100b74:	eb 03                	jmp    c0100b79 <parse+0x89>
            buf ++;
c0100b76:	ff 45 08             	incl   0x8(%ebp)
        while (*buf != '\0' && strchr(WHITESPACE, *buf) == NULL) {
c0100b79:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b7c:	0f b6 00             	movzbl (%eax),%eax
c0100b7f:	84 c0                	test   %al,%al
c0100b81:	74 8c                	je     c0100b0f <parse+0x1f>
c0100b83:	8b 45 08             	mov    0x8(%ebp),%eax
c0100b86:	0f b6 00             	movzbl (%eax),%eax
c0100b89:	0f be c0             	movsbl %al,%eax
c0100b8c:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100b90:	c7 04 24 d4 a2 10 c0 	movl   $0xc010a2d4,(%esp)
c0100b97:	e8 e0 89 00 00       	call   c010957c <strchr>
c0100b9c:	85 c0                	test   %eax,%eax
c0100b9e:	74 d6                	je     c0100b76 <parse+0x86>
        while (*buf != '\0' && strchr(WHITESPACE, *buf) != NULL) {
c0100ba0:	e9 6a ff ff ff       	jmp    c0100b0f <parse+0x1f>
            break;
c0100ba5:	90                   	nop
        }
    }
    return argc;
c0100ba6:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0100ba9:	c9                   	leave  
c0100baa:	c3                   	ret    

c0100bab <runcmd>:
/* *
 * runcmd - parse the input string, split it into separated arguments
 * and then lookup and invoke some related commands/
 * */
static int
runcmd(char *buf, struct trapframe *tf) {
c0100bab:	f3 0f 1e fb          	endbr32 
c0100baf:	55                   	push   %ebp
c0100bb0:	89 e5                	mov    %esp,%ebp
c0100bb2:	53                   	push   %ebx
c0100bb3:	83 ec 64             	sub    $0x64,%esp
    char *argv[MAXARGS];
    int argc = parse(buf, argv);
c0100bb6:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0100bb9:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100bbd:	8b 45 08             	mov    0x8(%ebp),%eax
c0100bc0:	89 04 24             	mov    %eax,(%esp)
c0100bc3:	e8 28 ff ff ff       	call   c0100af0 <parse>
c0100bc8:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (argc == 0) {
c0100bcb:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0100bcf:	75 0a                	jne    c0100bdb <runcmd+0x30>
        return 0;
c0100bd1:	b8 00 00 00 00       	mov    $0x0,%eax
c0100bd6:	e9 83 00 00 00       	jmp    c0100c5e <runcmd+0xb3>
    }
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100bdb:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100be2:	eb 5a                	jmp    c0100c3e <runcmd+0x93>
        if (strcmp(commands[i].name, argv[0]) == 0) {
c0100be4:	8b 4d b0             	mov    -0x50(%ebp),%ecx
c0100be7:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100bea:	89 d0                	mov    %edx,%eax
c0100bec:	01 c0                	add    %eax,%eax
c0100bee:	01 d0                	add    %edx,%eax
c0100bf0:	c1 e0 02             	shl    $0x2,%eax
c0100bf3:	05 00 80 12 c0       	add    $0xc0128000,%eax
c0100bf8:	8b 00                	mov    (%eax),%eax
c0100bfa:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0100bfe:	89 04 24             	mov    %eax,(%esp)
c0100c01:	e8 d2 88 00 00       	call   c01094d8 <strcmp>
c0100c06:	85 c0                	test   %eax,%eax
c0100c08:	75 31                	jne    c0100c3b <runcmd+0x90>
            return commands[i].func(argc - 1, argv + 1, tf);
c0100c0a:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100c0d:	89 d0                	mov    %edx,%eax
c0100c0f:	01 c0                	add    %eax,%eax
c0100c11:	01 d0                	add    %edx,%eax
c0100c13:	c1 e0 02             	shl    $0x2,%eax
c0100c16:	05 08 80 12 c0       	add    $0xc0128008,%eax
c0100c1b:	8b 10                	mov    (%eax),%edx
c0100c1d:	8d 45 b0             	lea    -0x50(%ebp),%eax
c0100c20:	83 c0 04             	add    $0x4,%eax
c0100c23:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0100c26:	8d 59 ff             	lea    -0x1(%ecx),%ebx
c0100c29:	8b 4d 0c             	mov    0xc(%ebp),%ecx
c0100c2c:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0100c30:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c34:	89 1c 24             	mov    %ebx,(%esp)
c0100c37:	ff d2                	call   *%edx
c0100c39:	eb 23                	jmp    c0100c5e <runcmd+0xb3>
    for (i = 0; i < NCOMMANDS; i ++) {
c0100c3b:	ff 45 f4             	incl   -0xc(%ebp)
c0100c3e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100c41:	83 f8 02             	cmp    $0x2,%eax
c0100c44:	76 9e                	jbe    c0100be4 <runcmd+0x39>
        }
    }
    cprintf("Unknown command '%s'\n", argv[0]);
c0100c46:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0100c49:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100c4d:	c7 04 24 f7 a2 10 c0 	movl   $0xc010a2f7,(%esp)
c0100c54:	e8 78 f6 ff ff       	call   c01002d1 <cprintf>
    return 0;
c0100c59:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100c5e:	83 c4 64             	add    $0x64,%esp
c0100c61:	5b                   	pop    %ebx
c0100c62:	5d                   	pop    %ebp
c0100c63:	c3                   	ret    

c0100c64 <kmonitor>:

/***** Implementations of basic kernel monitor commands *****/

void
kmonitor(struct trapframe *tf) {
c0100c64:	f3 0f 1e fb          	endbr32 
c0100c68:	55                   	push   %ebp
c0100c69:	89 e5                	mov    %esp,%ebp
c0100c6b:	83 ec 28             	sub    $0x28,%esp
    cprintf("Welcome to the kernel debug monitor!!\n");
c0100c6e:	c7 04 24 10 a3 10 c0 	movl   $0xc010a310,(%esp)
c0100c75:	e8 57 f6 ff ff       	call   c01002d1 <cprintf>
    cprintf("Type 'help' for a list of commands.\n");
c0100c7a:	c7 04 24 38 a3 10 c0 	movl   $0xc010a338,(%esp)
c0100c81:	e8 4b f6 ff ff       	call   c01002d1 <cprintf>

    if (tf != NULL) {
c0100c86:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0100c8a:	74 0b                	je     c0100c97 <kmonitor+0x33>
        print_trapframe(tf);
c0100c8c:	8b 45 08             	mov    0x8(%ebp),%eax
c0100c8f:	89 04 24             	mov    %eax,(%esp)
c0100c92:	e8 50 16 00 00       	call   c01022e7 <print_trapframe>
    }

    char *buf;
    while (1) {
        if ((buf = readline("K> ")) != NULL) {
c0100c97:	c7 04 24 5d a3 10 c0 	movl   $0xc010a35d,(%esp)
c0100c9e:	e8 e1 f6 ff ff       	call   c0100384 <readline>
c0100ca3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0100ca6:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0100caa:	74 eb                	je     c0100c97 <kmonitor+0x33>
            if (runcmd(buf, tf) < 0) {
c0100cac:	8b 45 08             	mov    0x8(%ebp),%eax
c0100caf:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100cb3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100cb6:	89 04 24             	mov    %eax,(%esp)
c0100cb9:	e8 ed fe ff ff       	call   c0100bab <runcmd>
c0100cbe:	85 c0                	test   %eax,%eax
c0100cc0:	78 02                	js     c0100cc4 <kmonitor+0x60>
        if ((buf = readline("K> ")) != NULL) {
c0100cc2:	eb d3                	jmp    c0100c97 <kmonitor+0x33>
                break;
c0100cc4:	90                   	nop
            }
        }
    }
}
c0100cc5:	90                   	nop
c0100cc6:	c9                   	leave  
c0100cc7:	c3                   	ret    

c0100cc8 <mon_help>:

/* mon_help - print the information about mon_* functions */
int
mon_help(int argc, char **argv, struct trapframe *tf) {
c0100cc8:	f3 0f 1e fb          	endbr32 
c0100ccc:	55                   	push   %ebp
c0100ccd:	89 e5                	mov    %esp,%ebp
c0100ccf:	83 ec 28             	sub    $0x28,%esp
    int i;
    for (i = 0; i < NCOMMANDS; i ++) {
c0100cd2:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0100cd9:	eb 3d                	jmp    c0100d18 <mon_help+0x50>
        cprintf("%s - %s\n", commands[i].name, commands[i].desc);
c0100cdb:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100cde:	89 d0                	mov    %edx,%eax
c0100ce0:	01 c0                	add    %eax,%eax
c0100ce2:	01 d0                	add    %edx,%eax
c0100ce4:	c1 e0 02             	shl    $0x2,%eax
c0100ce7:	05 04 80 12 c0       	add    $0xc0128004,%eax
c0100cec:	8b 08                	mov    (%eax),%ecx
c0100cee:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0100cf1:	89 d0                	mov    %edx,%eax
c0100cf3:	01 c0                	add    %eax,%eax
c0100cf5:	01 d0                	add    %edx,%eax
c0100cf7:	c1 e0 02             	shl    $0x2,%eax
c0100cfa:	05 00 80 12 c0       	add    $0xc0128000,%eax
c0100cff:	8b 00                	mov    (%eax),%eax
c0100d01:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0100d05:	89 44 24 04          	mov    %eax,0x4(%esp)
c0100d09:	c7 04 24 61 a3 10 c0 	movl   $0xc010a361,(%esp)
c0100d10:	e8 bc f5 ff ff       	call   c01002d1 <cprintf>
    for (i = 0; i < NCOMMANDS; i ++) {
c0100d15:	ff 45 f4             	incl   -0xc(%ebp)
c0100d18:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0100d1b:	83 f8 02             	cmp    $0x2,%eax
c0100d1e:	76 bb                	jbe    c0100cdb <mon_help+0x13>
    }
    return 0;
c0100d20:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100d25:	c9                   	leave  
c0100d26:	c3                   	ret    

c0100d27 <mon_kerninfo>:
/* *
 * mon_kerninfo - call print_kerninfo in kern/debug/kdebug.c to
 * print the memory occupancy in kernel.
 * */
int
mon_kerninfo(int argc, char **argv, struct trapframe *tf) {
c0100d27:	f3 0f 1e fb          	endbr32 
c0100d2b:	55                   	push   %ebp
c0100d2c:	89 e5                	mov    %esp,%ebp
c0100d2e:	83 ec 08             	sub    $0x8,%esp
    print_kerninfo();
c0100d31:	e8 5e fc ff ff       	call   c0100994 <print_kerninfo>
    return 0;
c0100d36:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100d3b:	c9                   	leave  
c0100d3c:	c3                   	ret    

c0100d3d <mon_backtrace>:
/* *
 * mon_backtrace - call print_stackframe in kern/debug/kdebug.c to
 * print a backtrace of the stack.
 * */
int
mon_backtrace(int argc, char **argv, struct trapframe *tf) {
c0100d3d:	f3 0f 1e fb          	endbr32 
c0100d41:	55                   	push   %ebp
c0100d42:	89 e5                	mov    %esp,%ebp
c0100d44:	83 ec 08             	sub    $0x8,%esp
    print_stackframe();
c0100d47:	e8 9a fd ff ff       	call   c0100ae6 <print_stackframe>
    return 0;
c0100d4c:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100d51:	c9                   	leave  
c0100d52:	c3                   	ret    

c0100d53 <ide_wait_ready>:
    unsigned int size;          // Size in Sectors
    unsigned char model[41];    // Model in String
} ide_devices[MAX_IDE];

static int
ide_wait_ready(unsigned short iobase, bool check_error) {
c0100d53:	f3 0f 1e fb          	endbr32 
c0100d57:	55                   	push   %ebp
c0100d58:	89 e5                	mov    %esp,%ebp
c0100d5a:	83 ec 14             	sub    $0x14,%esp
c0100d5d:	8b 45 08             	mov    0x8(%ebp),%eax
c0100d60:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    int r;
    while ((r = inb(iobase + ISA_STATUS)) & IDE_BSY)
c0100d64:	90                   	nop
c0100d65:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100d68:	83 c0 07             	add    $0x7,%eax
c0100d6b:	0f b7 c0             	movzwl %ax,%eax
c0100d6e:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
static inline void invlpg(void *addr) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
    uint8_t data;
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100d72:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0100d76:	89 c2                	mov    %eax,%edx
c0100d78:	ec                   	in     (%dx),%al
c0100d79:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0100d7c:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0100d80:	0f b6 c0             	movzbl %al,%eax
c0100d83:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0100d86:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100d89:	25 80 00 00 00       	and    $0x80,%eax
c0100d8e:	85 c0                	test   %eax,%eax
c0100d90:	75 d3                	jne    c0100d65 <ide_wait_ready+0x12>
        /* nothing */;
    if (check_error && (r & (IDE_DF | IDE_ERR)) != 0) {
c0100d92:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0100d96:	74 11                	je     c0100da9 <ide_wait_ready+0x56>
c0100d98:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0100d9b:	83 e0 21             	and    $0x21,%eax
c0100d9e:	85 c0                	test   %eax,%eax
c0100da0:	74 07                	je     c0100da9 <ide_wait_ready+0x56>
        return -1;
c0100da2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0100da7:	eb 05                	jmp    c0100dae <ide_wait_ready+0x5b>
    }
    return 0;
c0100da9:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0100dae:	c9                   	leave  
c0100daf:	c3                   	ret    

c0100db0 <ide_init>:

void
ide_init(void) {
c0100db0:	f3 0f 1e fb          	endbr32 
c0100db4:	55                   	push   %ebp
c0100db5:	89 e5                	mov    %esp,%ebp
c0100db7:	57                   	push   %edi
c0100db8:	53                   	push   %ebx
c0100db9:	81 ec 50 02 00 00    	sub    $0x250,%esp
    static_assert((SECTSIZE % 4) == 0);
    unsigned short ideno, iobase;
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c0100dbf:	66 c7 45 f6 00 00    	movw   $0x0,-0xa(%ebp)
c0100dc5:	e9 bd 02 00 00       	jmp    c0101087 <ide_init+0x2d7>
        /* assume that no device here */
        ide_devices[ideno].valid = 0;
c0100dca:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100dce:	89 d0                	mov    %edx,%eax
c0100dd0:	c1 e0 03             	shl    $0x3,%eax
c0100dd3:	29 d0                	sub    %edx,%eax
c0100dd5:	c1 e0 03             	shl    $0x3,%eax
c0100dd8:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0100ddd:	c6 00 00             	movb   $0x0,(%eax)

        iobase = IO_BASE(ideno);
c0100de0:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100de4:	d1 e8                	shr    %eax
c0100de6:	0f b7 c0             	movzwl %ax,%eax
c0100de9:	8b 04 85 6c a3 10 c0 	mov    -0x3fef5c94(,%eax,4),%eax
c0100df0:	66 89 45 ea          	mov    %ax,-0x16(%ebp)

        /* wait device ready */
        ide_wait_ready(iobase, 0);
c0100df4:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100df8:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100dff:	00 
c0100e00:	89 04 24             	mov    %eax,(%esp)
c0100e03:	e8 4b ff ff ff       	call   c0100d53 <ide_wait_ready>

        /* step1: select drive */
        outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4));
c0100e08:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0100e0c:	c1 e0 04             	shl    $0x4,%eax
c0100e0f:	24 10                	and    $0x10,%al
c0100e11:	0c e0                	or     $0xe0,%al
c0100e13:	0f b6 c0             	movzbl %al,%eax
c0100e16:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0100e1a:	83 c2 06             	add    $0x6,%edx
c0100e1d:	0f b7 d2             	movzwl %dx,%edx
c0100e20:	66 89 55 ca          	mov    %dx,-0x36(%ebp)
c0100e24:	88 45 c9             	mov    %al,-0x37(%ebp)
        : "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100e27:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c0100e2b:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c0100e2f:	ee                   	out    %al,(%dx)
}
c0100e30:	90                   	nop
        ide_wait_ready(iobase, 0);
c0100e31:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100e35:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100e3c:	00 
c0100e3d:	89 04 24             	mov    %eax,(%esp)
c0100e40:	e8 0e ff ff ff       	call   c0100d53 <ide_wait_ready>

        /* step2: send ATA identify command */
        outb(iobase + ISA_COMMAND, IDE_CMD_IDENTIFY);
c0100e45:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100e49:	83 c0 07             	add    $0x7,%eax
c0100e4c:	0f b7 c0             	movzwl %ax,%eax
c0100e4f:	66 89 45 ce          	mov    %ax,-0x32(%ebp)
c0100e53:	c6 45 cd ec          	movb   $0xec,-0x33(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0100e57:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c0100e5b:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c0100e5f:	ee                   	out    %al,(%dx)
}
c0100e60:	90                   	nop
        ide_wait_ready(iobase, 0);
c0100e61:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100e65:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0100e6c:	00 
c0100e6d:	89 04 24             	mov    %eax,(%esp)
c0100e70:	e8 de fe ff ff       	call   c0100d53 <ide_wait_ready>

        /* step3: polling */
        if (inb(iobase + ISA_STATUS) == 0 || ide_wait_ready(iobase, 1) != 0) {
c0100e75:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100e79:	83 c0 07             	add    $0x7,%eax
c0100e7c:	0f b7 c0             	movzwl %ax,%eax
c0100e7f:	66 89 45 d2          	mov    %ax,-0x2e(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0100e83:	0f b7 45 d2          	movzwl -0x2e(%ebp),%eax
c0100e87:	89 c2                	mov    %eax,%edx
c0100e89:	ec                   	in     (%dx),%al
c0100e8a:	88 45 d1             	mov    %al,-0x2f(%ebp)
    return data;
c0100e8d:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c0100e91:	84 c0                	test   %al,%al
c0100e93:	0f 84 e4 01 00 00    	je     c010107d <ide_init+0x2cd>
c0100e99:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100e9d:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0100ea4:	00 
c0100ea5:	89 04 24             	mov    %eax,(%esp)
c0100ea8:	e8 a6 fe ff ff       	call   c0100d53 <ide_wait_ready>
c0100ead:	85 c0                	test   %eax,%eax
c0100eaf:	0f 85 c8 01 00 00    	jne    c010107d <ide_init+0x2cd>
            continue ;
        }

        /* device is ok */
        ide_devices[ideno].valid = 1;
c0100eb5:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100eb9:	89 d0                	mov    %edx,%eax
c0100ebb:	c1 e0 03             	shl    $0x3,%eax
c0100ebe:	29 d0                	sub    %edx,%eax
c0100ec0:	c1 e0 03             	shl    $0x3,%eax
c0100ec3:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0100ec8:	c6 00 01             	movb   $0x1,(%eax)

        /* read identification space of the device */
        unsigned int buffer[128];
        insl(iobase + ISA_DATA, buffer, sizeof(buffer) / sizeof(unsigned int));
c0100ecb:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c0100ecf:	89 45 c4             	mov    %eax,-0x3c(%ebp)
c0100ed2:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c0100ed8:	89 45 c0             	mov    %eax,-0x40(%ebp)
c0100edb:	c7 45 bc 80 00 00 00 	movl   $0x80,-0x44(%ebp)
    asm volatile (
c0100ee2:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0100ee5:	8b 4d c0             	mov    -0x40(%ebp),%ecx
c0100ee8:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0100eeb:	89 cb                	mov    %ecx,%ebx
c0100eed:	89 df                	mov    %ebx,%edi
c0100eef:	89 c1                	mov    %eax,%ecx
c0100ef1:	fc                   	cld    
c0100ef2:	f2 6d                	repnz insl (%dx),%es:(%edi)
c0100ef4:	89 c8                	mov    %ecx,%eax
c0100ef6:	89 fb                	mov    %edi,%ebx
c0100ef8:	89 5d c0             	mov    %ebx,-0x40(%ebp)
c0100efb:	89 45 bc             	mov    %eax,-0x44(%ebp)
}
c0100efe:	90                   	nop

        unsigned char *ident = (unsigned char *)buffer;
c0100eff:	8d 85 bc fd ff ff    	lea    -0x244(%ebp),%eax
c0100f05:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        unsigned int sectors;
        unsigned int cmdsets = *(unsigned int *)(ident + IDE_IDENT_CMDSETS);
c0100f08:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100f0b:	8b 80 a4 00 00 00    	mov    0xa4(%eax),%eax
c0100f11:	89 45 e0             	mov    %eax,-0x20(%ebp)
        /* device use 48-bits or 28-bits addressing */
        if (cmdsets & (1 << 26)) {
c0100f14:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100f17:	25 00 00 00 04       	and    $0x4000000,%eax
c0100f1c:	85 c0                	test   %eax,%eax
c0100f1e:	74 0e                	je     c0100f2e <ide_init+0x17e>
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA_EXT);
c0100f20:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100f23:	8b 80 c8 00 00 00    	mov    0xc8(%eax),%eax
c0100f29:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0100f2c:	eb 09                	jmp    c0100f37 <ide_init+0x187>
        }
        else {
            sectors = *(unsigned int *)(ident + IDE_IDENT_MAX_LBA);
c0100f2e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100f31:	8b 40 78             	mov    0x78(%eax),%eax
c0100f34:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        ide_devices[ideno].sets = cmdsets;
c0100f37:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100f3b:	89 d0                	mov    %edx,%eax
c0100f3d:	c1 e0 03             	shl    $0x3,%eax
c0100f40:	29 d0                	sub    %edx,%eax
c0100f42:	c1 e0 03             	shl    $0x3,%eax
c0100f45:	8d 90 44 b4 12 c0    	lea    -0x3fed4bbc(%eax),%edx
c0100f4b:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0100f4e:	89 02                	mov    %eax,(%edx)
        ide_devices[ideno].size = sectors;
c0100f50:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100f54:	89 d0                	mov    %edx,%eax
c0100f56:	c1 e0 03             	shl    $0x3,%eax
c0100f59:	29 d0                	sub    %edx,%eax
c0100f5b:	c1 e0 03             	shl    $0x3,%eax
c0100f5e:	8d 90 48 b4 12 c0    	lea    -0x3fed4bb8(%eax),%edx
c0100f64:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0100f67:	89 02                	mov    %eax,(%edx)

        /* check if supports LBA */
        assert((*(unsigned short *)(ident + IDE_IDENT_CAPABILITIES) & 0x200) != 0);
c0100f69:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100f6c:	83 c0 62             	add    $0x62,%eax
c0100f6f:	0f b7 00             	movzwl (%eax),%eax
c0100f72:	25 00 02 00 00       	and    $0x200,%eax
c0100f77:	85 c0                	test   %eax,%eax
c0100f79:	75 24                	jne    c0100f9f <ide_init+0x1ef>
c0100f7b:	c7 44 24 0c 74 a3 10 	movl   $0xc010a374,0xc(%esp)
c0100f82:	c0 
c0100f83:	c7 44 24 08 b7 a3 10 	movl   $0xc010a3b7,0x8(%esp)
c0100f8a:	c0 
c0100f8b:	c7 44 24 04 7d 00 00 	movl   $0x7d,0x4(%esp)
c0100f92:	00 
c0100f93:	c7 04 24 cc a3 10 c0 	movl   $0xc010a3cc,(%esp)
c0100f9a:	e8 9e f4 ff ff       	call   c010043d <__panic>

        unsigned char *model = ide_devices[ideno].model, *data = ident + IDE_IDENT_MODEL;
c0100f9f:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0100fa3:	89 d0                	mov    %edx,%eax
c0100fa5:	c1 e0 03             	shl    $0x3,%eax
c0100fa8:	29 d0                	sub    %edx,%eax
c0100faa:	c1 e0 03             	shl    $0x3,%eax
c0100fad:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0100fb2:	83 c0 0c             	add    $0xc,%eax
c0100fb5:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0100fb8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0100fbb:	83 c0 36             	add    $0x36,%eax
c0100fbe:	89 45 d8             	mov    %eax,-0x28(%ebp)
        unsigned int i, length = 40;
c0100fc1:	c7 45 d4 28 00 00 00 	movl   $0x28,-0x2c(%ebp)
        for (i = 0; i < length; i += 2) {
c0100fc8:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0100fcf:	eb 34                	jmp    c0101005 <ide_init+0x255>
            model[i] = data[i + 1], model[i + 1] = data[i];
c0100fd1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100fd4:	8d 50 01             	lea    0x1(%eax),%edx
c0100fd7:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0100fda:	01 c2                	add    %eax,%edx
c0100fdc:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0100fdf:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100fe2:	01 c8                	add    %ecx,%eax
c0100fe4:	0f b6 12             	movzbl (%edx),%edx
c0100fe7:	88 10                	mov    %dl,(%eax)
c0100fe9:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0100fec:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100fef:	01 c2                	add    %eax,%edx
c0100ff1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0100ff4:	8d 48 01             	lea    0x1(%eax),%ecx
c0100ff7:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0100ffa:	01 c8                	add    %ecx,%eax
c0100ffc:	0f b6 12             	movzbl (%edx),%edx
c0100fff:	88 10                	mov    %dl,(%eax)
        for (i = 0; i < length; i += 2) {
c0101001:	83 45 ec 02          	addl   $0x2,-0x14(%ebp)
c0101005:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101008:	3b 45 d4             	cmp    -0x2c(%ebp),%eax
c010100b:	72 c4                	jb     c0100fd1 <ide_init+0x221>
        }
        do {
            model[i] = '\0';
c010100d:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0101010:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101013:	01 d0                	add    %edx,%eax
c0101015:	c6 00 00             	movb   $0x0,(%eax)
        } while (i -- > 0 && model[i] == ' ');
c0101018:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010101b:	8d 50 ff             	lea    -0x1(%eax),%edx
c010101e:	89 55 ec             	mov    %edx,-0x14(%ebp)
c0101021:	85 c0                	test   %eax,%eax
c0101023:	74 0f                	je     c0101034 <ide_init+0x284>
c0101025:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0101028:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010102b:	01 d0                	add    %edx,%eax
c010102d:	0f b6 00             	movzbl (%eax),%eax
c0101030:	3c 20                	cmp    $0x20,%al
c0101032:	74 d9                	je     c010100d <ide_init+0x25d>

        cprintf("ide %d: %10u(sectors), '%s'.\n", ideno, ide_devices[ideno].size, ide_devices[ideno].model);
c0101034:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101038:	89 d0                	mov    %edx,%eax
c010103a:	c1 e0 03             	shl    $0x3,%eax
c010103d:	29 d0                	sub    %edx,%eax
c010103f:	c1 e0 03             	shl    $0x3,%eax
c0101042:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0101047:	8d 48 0c             	lea    0xc(%eax),%ecx
c010104a:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c010104e:	89 d0                	mov    %edx,%eax
c0101050:	c1 e0 03             	shl    $0x3,%eax
c0101053:	29 d0                	sub    %edx,%eax
c0101055:	c1 e0 03             	shl    $0x3,%eax
c0101058:	05 48 b4 12 c0       	add    $0xc012b448,%eax
c010105d:	8b 10                	mov    (%eax),%edx
c010105f:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101063:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0101067:	89 54 24 08          	mov    %edx,0x8(%esp)
c010106b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010106f:	c7 04 24 de a3 10 c0 	movl   $0xc010a3de,(%esp)
c0101076:	e8 56 f2 ff ff       	call   c01002d1 <cprintf>
c010107b:	eb 01                	jmp    c010107e <ide_init+0x2ce>
            continue ;
c010107d:	90                   	nop
    for (ideno = 0; ideno < MAX_IDE; ideno ++) {
c010107e:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101082:	40                   	inc    %eax
c0101083:	66 89 45 f6          	mov    %ax,-0xa(%ebp)
c0101087:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010108b:	83 f8 03             	cmp    $0x3,%eax
c010108e:	0f 86 36 fd ff ff    	jbe    c0100dca <ide_init+0x1a>
    }

    // enable ide interrupt
    pic_enable(IRQ_IDE1);
c0101094:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
c010109b:	e8 1f 0f 00 00       	call   c0101fbf <pic_enable>
    pic_enable(IRQ_IDE2);
c01010a0:	c7 04 24 0f 00 00 00 	movl   $0xf,(%esp)
c01010a7:	e8 13 0f 00 00       	call   c0101fbf <pic_enable>
}
c01010ac:	90                   	nop
c01010ad:	81 c4 50 02 00 00    	add    $0x250,%esp
c01010b3:	5b                   	pop    %ebx
c01010b4:	5f                   	pop    %edi
c01010b5:	5d                   	pop    %ebp
c01010b6:	c3                   	ret    

c01010b7 <ide_device_valid>:

bool
ide_device_valid(unsigned short ideno) {
c01010b7:	f3 0f 1e fb          	endbr32 
c01010bb:	55                   	push   %ebp
c01010bc:	89 e5                	mov    %esp,%ebp
c01010be:	83 ec 04             	sub    $0x4,%esp
c01010c1:	8b 45 08             	mov    0x8(%ebp),%eax
c01010c4:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    return VALID_IDE(ideno);
c01010c8:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c01010cc:	83 f8 03             	cmp    $0x3,%eax
c01010cf:	77 21                	ja     c01010f2 <ide_device_valid+0x3b>
c01010d1:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
c01010d5:	89 d0                	mov    %edx,%eax
c01010d7:	c1 e0 03             	shl    $0x3,%eax
c01010da:	29 d0                	sub    %edx,%eax
c01010dc:	c1 e0 03             	shl    $0x3,%eax
c01010df:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c01010e4:	0f b6 00             	movzbl (%eax),%eax
c01010e7:	84 c0                	test   %al,%al
c01010e9:	74 07                	je     c01010f2 <ide_device_valid+0x3b>
c01010eb:	b8 01 00 00 00       	mov    $0x1,%eax
c01010f0:	eb 05                	jmp    c01010f7 <ide_device_valid+0x40>
c01010f2:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01010f7:	c9                   	leave  
c01010f8:	c3                   	ret    

c01010f9 <ide_device_size>:

size_t
ide_device_size(unsigned short ideno) {
c01010f9:	f3 0f 1e fb          	endbr32 
c01010fd:	55                   	push   %ebp
c01010fe:	89 e5                	mov    %esp,%ebp
c0101100:	83 ec 08             	sub    $0x8,%esp
c0101103:	8b 45 08             	mov    0x8(%ebp),%eax
c0101106:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
    if (ide_device_valid(ideno)) {
c010110a:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
c010110e:	89 04 24             	mov    %eax,(%esp)
c0101111:	e8 a1 ff ff ff       	call   c01010b7 <ide_device_valid>
c0101116:	85 c0                	test   %eax,%eax
c0101118:	74 17                	je     c0101131 <ide_device_size+0x38>
        return ide_devices[ideno].size;
c010111a:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
c010111e:	89 d0                	mov    %edx,%eax
c0101120:	c1 e0 03             	shl    $0x3,%eax
c0101123:	29 d0                	sub    %edx,%eax
c0101125:	c1 e0 03             	shl    $0x3,%eax
c0101128:	05 48 b4 12 c0       	add    $0xc012b448,%eax
c010112d:	8b 00                	mov    (%eax),%eax
c010112f:	eb 05                	jmp    c0101136 <ide_device_size+0x3d>
    }
    return 0;
c0101131:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0101136:	c9                   	leave  
c0101137:	c3                   	ret    

c0101138 <ide_read_secs>:

int
ide_read_secs(unsigned short ideno, uint32_t secno, void *dst, size_t nsecs) {
c0101138:	f3 0f 1e fb          	endbr32 
c010113c:	55                   	push   %ebp
c010113d:	89 e5                	mov    %esp,%ebp
c010113f:	57                   	push   %edi
c0101140:	53                   	push   %ebx
c0101141:	83 ec 50             	sub    $0x50,%esp
c0101144:	8b 45 08             	mov    0x8(%ebp),%eax
c0101147:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c010114b:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c0101152:	77 23                	ja     c0101177 <ide_read_secs+0x3f>
c0101154:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101158:	83 f8 03             	cmp    $0x3,%eax
c010115b:	77 1a                	ja     c0101177 <ide_read_secs+0x3f>
c010115d:	0f b7 55 c4          	movzwl -0x3c(%ebp),%edx
c0101161:	89 d0                	mov    %edx,%eax
c0101163:	c1 e0 03             	shl    $0x3,%eax
c0101166:	29 d0                	sub    %edx,%eax
c0101168:	c1 e0 03             	shl    $0x3,%eax
c010116b:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c0101170:	0f b6 00             	movzbl (%eax),%eax
c0101173:	84 c0                	test   %al,%al
c0101175:	75 24                	jne    c010119b <ide_read_secs+0x63>
c0101177:	c7 44 24 0c fc a3 10 	movl   $0xc010a3fc,0xc(%esp)
c010117e:	c0 
c010117f:	c7 44 24 08 b7 a3 10 	movl   $0xc010a3b7,0x8(%esp)
c0101186:	c0 
c0101187:	c7 44 24 04 9f 00 00 	movl   $0x9f,0x4(%esp)
c010118e:	00 
c010118f:	c7 04 24 cc a3 10 c0 	movl   $0xc010a3cc,(%esp)
c0101196:	e8 a2 f2 ff ff       	call   c010043d <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c010119b:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c01011a2:	77 0f                	ja     c01011b3 <ide_read_secs+0x7b>
c01011a4:	8b 55 0c             	mov    0xc(%ebp),%edx
c01011a7:	8b 45 14             	mov    0x14(%ebp),%eax
c01011aa:	01 d0                	add    %edx,%eax
c01011ac:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c01011b1:	76 24                	jbe    c01011d7 <ide_read_secs+0x9f>
c01011b3:	c7 44 24 0c 24 a4 10 	movl   $0xc010a424,0xc(%esp)
c01011ba:	c0 
c01011bb:	c7 44 24 08 b7 a3 10 	movl   $0xc010a3b7,0x8(%esp)
c01011c2:	c0 
c01011c3:	c7 44 24 04 a0 00 00 	movl   $0xa0,0x4(%esp)
c01011ca:	00 
c01011cb:	c7 04 24 cc a3 10 c0 	movl   $0xc010a3cc,(%esp)
c01011d2:	e8 66 f2 ff ff       	call   c010043d <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c01011d7:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c01011db:	d1 e8                	shr    %eax
c01011dd:	0f b7 c0             	movzwl %ax,%eax
c01011e0:	8b 04 85 6c a3 10 c0 	mov    -0x3fef5c94(,%eax,4),%eax
c01011e7:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c01011eb:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c01011ef:	d1 e8                	shr    %eax
c01011f1:	0f b7 c0             	movzwl %ax,%eax
c01011f4:	0f b7 04 85 6e a3 10 	movzwl -0x3fef5c92(,%eax,4),%eax
c01011fb:	c0 
c01011fc:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c0101200:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101204:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010120b:	00 
c010120c:	89 04 24             	mov    %eax,(%esp)
c010120f:	e8 3f fb ff ff       	call   c0100d53 <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c0101214:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101217:	83 c0 02             	add    $0x2,%eax
c010121a:	0f b7 c0             	movzwl %ax,%eax
c010121d:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c0101221:	c6 45 d5 00          	movb   $0x0,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101225:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0101229:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c010122d:	ee                   	out    %al,(%dx)
}
c010122e:	90                   	nop
    outb(iobase + ISA_SECCNT, nsecs);
c010122f:	8b 45 14             	mov    0x14(%ebp),%eax
c0101232:	0f b6 c0             	movzbl %al,%eax
c0101235:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101239:	83 c2 02             	add    $0x2,%edx
c010123c:	0f b7 d2             	movzwl %dx,%edx
c010123f:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c0101243:	88 45 d9             	mov    %al,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101246:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c010124a:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c010124e:	ee                   	out    %al,(%dx)
}
c010124f:	90                   	nop
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c0101250:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101253:	0f b6 c0             	movzbl %al,%eax
c0101256:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010125a:	83 c2 03             	add    $0x3,%edx
c010125d:	0f b7 d2             	movzwl %dx,%edx
c0101260:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c0101264:	88 45 dd             	mov    %al,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101267:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c010126b:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c010126f:	ee                   	out    %al,(%dx)
}
c0101270:	90                   	nop
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c0101271:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101274:	c1 e8 08             	shr    $0x8,%eax
c0101277:	0f b6 c0             	movzbl %al,%eax
c010127a:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010127e:	83 c2 04             	add    $0x4,%edx
c0101281:	0f b7 d2             	movzwl %dx,%edx
c0101284:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c0101288:	88 45 e1             	mov    %al,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010128b:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c010128f:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0101293:	ee                   	out    %al,(%dx)
}
c0101294:	90                   	nop
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c0101295:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101298:	c1 e8 10             	shr    $0x10,%eax
c010129b:	0f b6 c0             	movzbl %al,%eax
c010129e:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01012a2:	83 c2 05             	add    $0x5,%edx
c01012a5:	0f b7 d2             	movzwl %dx,%edx
c01012a8:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c01012ac:	88 45 e5             	mov    %al,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01012af:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01012b3:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01012b7:	ee                   	out    %al,(%dx)
}
c01012b8:	90                   	nop
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c01012b9:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c01012bc:	c0 e0 04             	shl    $0x4,%al
c01012bf:	24 10                	and    $0x10,%al
c01012c1:	88 c2                	mov    %al,%dl
c01012c3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01012c6:	c1 e8 18             	shr    $0x18,%eax
c01012c9:	24 0f                	and    $0xf,%al
c01012cb:	08 d0                	or     %dl,%al
c01012cd:	0c e0                	or     $0xe0,%al
c01012cf:	0f b6 c0             	movzbl %al,%eax
c01012d2:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01012d6:	83 c2 06             	add    $0x6,%edx
c01012d9:	0f b7 d2             	movzwl %dx,%edx
c01012dc:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c01012e0:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01012e3:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01012e7:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01012eb:	ee                   	out    %al,(%dx)
}
c01012ec:	90                   	nop
    outb(iobase + ISA_COMMAND, IDE_CMD_READ);
c01012ed:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c01012f1:	83 c0 07             	add    $0x7,%eax
c01012f4:	0f b7 c0             	movzwl %ax,%eax
c01012f7:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c01012fb:	c6 45 ed 20          	movb   $0x20,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01012ff:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101303:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101307:	ee                   	out    %al,(%dx)
}
c0101308:	90                   	nop

    int ret = 0;
c0101309:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c0101310:	eb 58                	jmp    c010136a <ide_read_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c0101312:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101316:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010131d:	00 
c010131e:	89 04 24             	mov    %eax,(%esp)
c0101321:	e8 2d fa ff ff       	call   c0100d53 <ide_wait_ready>
c0101326:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101329:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010132d:	75 43                	jne    c0101372 <ide_read_secs+0x23a>
            goto out;
        }
        insl(iobase, dst, SECTSIZE / sizeof(uint32_t));
c010132f:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101333:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0101336:	8b 45 10             	mov    0x10(%ebp),%eax
c0101339:	89 45 cc             	mov    %eax,-0x34(%ebp)
c010133c:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    asm volatile (
c0101343:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0101346:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c0101349:	8b 45 c8             	mov    -0x38(%ebp),%eax
c010134c:	89 cb                	mov    %ecx,%ebx
c010134e:	89 df                	mov    %ebx,%edi
c0101350:	89 c1                	mov    %eax,%ecx
c0101352:	fc                   	cld    
c0101353:	f2 6d                	repnz insl (%dx),%es:(%edi)
c0101355:	89 c8                	mov    %ecx,%eax
c0101357:	89 fb                	mov    %edi,%ebx
c0101359:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c010135c:	89 45 c8             	mov    %eax,-0x38(%ebp)
}
c010135f:	90                   	nop
    for (; nsecs > 0; nsecs --, dst += SECTSIZE) {
c0101360:	ff 4d 14             	decl   0x14(%ebp)
c0101363:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c010136a:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c010136e:	75 a2                	jne    c0101312 <ide_read_secs+0x1da>
    }

out:
c0101370:	eb 01                	jmp    c0101373 <ide_read_secs+0x23b>
            goto out;
c0101372:	90                   	nop
    return ret;
c0101373:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101376:	83 c4 50             	add    $0x50,%esp
c0101379:	5b                   	pop    %ebx
c010137a:	5f                   	pop    %edi
c010137b:	5d                   	pop    %ebp
c010137c:	c3                   	ret    

c010137d <ide_write_secs>:

int
ide_write_secs(unsigned short ideno, uint32_t secno, const void *src, size_t nsecs) {
c010137d:	f3 0f 1e fb          	endbr32 
c0101381:	55                   	push   %ebp
c0101382:	89 e5                	mov    %esp,%ebp
c0101384:	56                   	push   %esi
c0101385:	53                   	push   %ebx
c0101386:	83 ec 50             	sub    $0x50,%esp
c0101389:	8b 45 08             	mov    0x8(%ebp),%eax
c010138c:	66 89 45 c4          	mov    %ax,-0x3c(%ebp)
    assert(nsecs <= MAX_NSECS && VALID_IDE(ideno));
c0101390:	81 7d 14 80 00 00 00 	cmpl   $0x80,0x14(%ebp)
c0101397:	77 23                	ja     c01013bc <ide_write_secs+0x3f>
c0101399:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c010139d:	83 f8 03             	cmp    $0x3,%eax
c01013a0:	77 1a                	ja     c01013bc <ide_write_secs+0x3f>
c01013a2:	0f b7 55 c4          	movzwl -0x3c(%ebp),%edx
c01013a6:	89 d0                	mov    %edx,%eax
c01013a8:	c1 e0 03             	shl    $0x3,%eax
c01013ab:	29 d0                	sub    %edx,%eax
c01013ad:	c1 e0 03             	shl    $0x3,%eax
c01013b0:	05 40 b4 12 c0       	add    $0xc012b440,%eax
c01013b5:	0f b6 00             	movzbl (%eax),%eax
c01013b8:	84 c0                	test   %al,%al
c01013ba:	75 24                	jne    c01013e0 <ide_write_secs+0x63>
c01013bc:	c7 44 24 0c fc a3 10 	movl   $0xc010a3fc,0xc(%esp)
c01013c3:	c0 
c01013c4:	c7 44 24 08 b7 a3 10 	movl   $0xc010a3b7,0x8(%esp)
c01013cb:	c0 
c01013cc:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c01013d3:	00 
c01013d4:	c7 04 24 cc a3 10 c0 	movl   $0xc010a3cc,(%esp)
c01013db:	e8 5d f0 ff ff       	call   c010043d <__panic>
    assert(secno < MAX_DISK_NSECS && secno + nsecs <= MAX_DISK_NSECS);
c01013e0:	81 7d 0c ff ff ff 0f 	cmpl   $0xfffffff,0xc(%ebp)
c01013e7:	77 0f                	ja     c01013f8 <ide_write_secs+0x7b>
c01013e9:	8b 55 0c             	mov    0xc(%ebp),%edx
c01013ec:	8b 45 14             	mov    0x14(%ebp),%eax
c01013ef:	01 d0                	add    %edx,%eax
c01013f1:	3d 00 00 00 10       	cmp    $0x10000000,%eax
c01013f6:	76 24                	jbe    c010141c <ide_write_secs+0x9f>
c01013f8:	c7 44 24 0c 24 a4 10 	movl   $0xc010a424,0xc(%esp)
c01013ff:	c0 
c0101400:	c7 44 24 08 b7 a3 10 	movl   $0xc010a3b7,0x8(%esp)
c0101407:	c0 
c0101408:	c7 44 24 04 bd 00 00 	movl   $0xbd,0x4(%esp)
c010140f:	00 
c0101410:	c7 04 24 cc a3 10 c0 	movl   $0xc010a3cc,(%esp)
c0101417:	e8 21 f0 ff ff       	call   c010043d <__panic>
    unsigned short iobase = IO_BASE(ideno), ioctrl = IO_CTRL(ideno);
c010141c:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101420:	d1 e8                	shr    %eax
c0101422:	0f b7 c0             	movzwl %ax,%eax
c0101425:	8b 04 85 6c a3 10 c0 	mov    -0x3fef5c94(,%eax,4),%eax
c010142c:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
c0101430:	0f b7 45 c4          	movzwl -0x3c(%ebp),%eax
c0101434:	d1 e8                	shr    %eax
c0101436:	0f b7 c0             	movzwl %ax,%eax
c0101439:	0f b7 04 85 6e a3 10 	movzwl -0x3fef5c92(,%eax,4),%eax
c0101440:	c0 
c0101441:	66 89 45 f0          	mov    %ax,-0x10(%ebp)

    ide_wait_ready(iobase, 0);
c0101445:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101449:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0101450:	00 
c0101451:	89 04 24             	mov    %eax,(%esp)
c0101454:	e8 fa f8 ff ff       	call   c0100d53 <ide_wait_ready>

    // generate interrupt
    outb(ioctrl + ISA_CTRL, 0);
c0101459:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010145c:	83 c0 02             	add    $0x2,%eax
c010145f:	0f b7 c0             	movzwl %ax,%eax
c0101462:	66 89 45 d6          	mov    %ax,-0x2a(%ebp)
c0101466:	c6 45 d5 00          	movb   $0x0,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010146a:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c010146e:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0101472:	ee                   	out    %al,(%dx)
}
c0101473:	90                   	nop
    outb(iobase + ISA_SECCNT, nsecs);
c0101474:	8b 45 14             	mov    0x14(%ebp),%eax
c0101477:	0f b6 c0             	movzbl %al,%eax
c010147a:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010147e:	83 c2 02             	add    $0x2,%edx
c0101481:	0f b7 d2             	movzwl %dx,%edx
c0101484:	66 89 55 da          	mov    %dx,-0x26(%ebp)
c0101488:	88 45 d9             	mov    %al,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010148b:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c010148f:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c0101493:	ee                   	out    %al,(%dx)
}
c0101494:	90                   	nop
    outb(iobase + ISA_SECTOR, secno & 0xFF);
c0101495:	8b 45 0c             	mov    0xc(%ebp),%eax
c0101498:	0f b6 c0             	movzbl %al,%eax
c010149b:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010149f:	83 c2 03             	add    $0x3,%edx
c01014a2:	0f b7 d2             	movzwl %dx,%edx
c01014a5:	66 89 55 de          	mov    %dx,-0x22(%ebp)
c01014a9:	88 45 dd             	mov    %al,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01014ac:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c01014b0:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c01014b4:	ee                   	out    %al,(%dx)
}
c01014b5:	90                   	nop
    outb(iobase + ISA_CYL_LO, (secno >> 8) & 0xFF);
c01014b6:	8b 45 0c             	mov    0xc(%ebp),%eax
c01014b9:	c1 e8 08             	shr    $0x8,%eax
c01014bc:	0f b6 c0             	movzbl %al,%eax
c01014bf:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01014c3:	83 c2 04             	add    $0x4,%edx
c01014c6:	0f b7 d2             	movzwl %dx,%edx
c01014c9:	66 89 55 e2          	mov    %dx,-0x1e(%ebp)
c01014cd:	88 45 e1             	mov    %al,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01014d0:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c01014d4:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c01014d8:	ee                   	out    %al,(%dx)
}
c01014d9:	90                   	nop
    outb(iobase + ISA_CYL_HI, (secno >> 16) & 0xFF);
c01014da:	8b 45 0c             	mov    0xc(%ebp),%eax
c01014dd:	c1 e8 10             	shr    $0x10,%eax
c01014e0:	0f b6 c0             	movzbl %al,%eax
c01014e3:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01014e7:	83 c2 05             	add    $0x5,%edx
c01014ea:	0f b7 d2             	movzwl %dx,%edx
c01014ed:	66 89 55 e6          	mov    %dx,-0x1a(%ebp)
c01014f1:	88 45 e5             	mov    %al,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01014f4:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01014f8:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01014fc:	ee                   	out    %al,(%dx)
}
c01014fd:	90                   	nop
    outb(iobase + ISA_SDH, 0xE0 | ((ideno & 1) << 4) | ((secno >> 24) & 0xF));
c01014fe:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0101501:	c0 e0 04             	shl    $0x4,%al
c0101504:	24 10                	and    $0x10,%al
c0101506:	88 c2                	mov    %al,%dl
c0101508:	8b 45 0c             	mov    0xc(%ebp),%eax
c010150b:	c1 e8 18             	shr    $0x18,%eax
c010150e:	24 0f                	and    $0xf,%al
c0101510:	08 d0                	or     %dl,%al
c0101512:	0c e0                	or     $0xe0,%al
c0101514:	0f b6 c0             	movzbl %al,%eax
c0101517:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c010151b:	83 c2 06             	add    $0x6,%edx
c010151e:	0f b7 d2             	movzwl %dx,%edx
c0101521:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101525:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101528:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c010152c:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101530:	ee                   	out    %al,(%dx)
}
c0101531:	90                   	nop
    outb(iobase + ISA_COMMAND, IDE_CMD_WRITE);
c0101532:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101536:	83 c0 07             	add    $0x7,%eax
c0101539:	0f b7 c0             	movzwl %ax,%eax
c010153c:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101540:	c6 45 ed 30          	movb   $0x30,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101544:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101548:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c010154c:	ee                   	out    %al,(%dx)
}
c010154d:	90                   	nop

    int ret = 0;
c010154e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c0101555:	eb 58                	jmp    c01015af <ide_write_secs+0x232>
        if ((ret = ide_wait_ready(iobase, 1)) != 0) {
c0101557:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c010155b:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0101562:	00 
c0101563:	89 04 24             	mov    %eax,(%esp)
c0101566:	e8 e8 f7 ff ff       	call   c0100d53 <ide_wait_ready>
c010156b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010156e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101572:	75 43                	jne    c01015b7 <ide_write_secs+0x23a>
            goto out;
        }
        outsl(iobase, src, SECTSIZE / sizeof(uint32_t));
c0101574:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101578:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010157b:	8b 45 10             	mov    0x10(%ebp),%eax
c010157e:	89 45 cc             	mov    %eax,-0x34(%ebp)
c0101581:	c7 45 c8 80 00 00 00 	movl   $0x80,-0x38(%ebp)
    asm volatile ("outw %0, %1" :: "a" (data), "d" (port) : "memory");
}

static inline void
outsl(uint32_t port, const void *addr, int cnt) {
    asm volatile (
c0101588:	8b 55 d0             	mov    -0x30(%ebp),%edx
c010158b:	8b 4d cc             	mov    -0x34(%ebp),%ecx
c010158e:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0101591:	89 cb                	mov    %ecx,%ebx
c0101593:	89 de                	mov    %ebx,%esi
c0101595:	89 c1                	mov    %eax,%ecx
c0101597:	fc                   	cld    
c0101598:	f2 6f                	repnz outsl %ds:(%esi),(%dx)
c010159a:	89 c8                	mov    %ecx,%eax
c010159c:	89 f3                	mov    %esi,%ebx
c010159e:	89 5d cc             	mov    %ebx,-0x34(%ebp)
c01015a1:	89 45 c8             	mov    %eax,-0x38(%ebp)
        "cld;"
        "repne; outsl;"
        : "=S" (addr), "=c" (cnt)
        : "d" (port), "0" (addr), "1" (cnt)
        : "memory", "cc");
}
c01015a4:	90                   	nop
    for (; nsecs > 0; nsecs --, src += SECTSIZE) {
c01015a5:	ff 4d 14             	decl   0x14(%ebp)
c01015a8:	81 45 10 00 02 00 00 	addl   $0x200,0x10(%ebp)
c01015af:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
c01015b3:	75 a2                	jne    c0101557 <ide_write_secs+0x1da>
    }

out:
c01015b5:	eb 01                	jmp    c01015b8 <ide_write_secs+0x23b>
            goto out;
c01015b7:	90                   	nop
    return ret;
c01015b8:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01015bb:	83 c4 50             	add    $0x50,%esp
c01015be:	5b                   	pop    %ebx
c01015bf:	5e                   	pop    %esi
c01015c0:	5d                   	pop    %ebp
c01015c1:	c3                   	ret    

c01015c2 <clock_init>:
/* *
 * clock_init - initialize 8253 clock to interrupt 100 times per second,
 * and then enable IRQ_TIMER.
 * */
void
clock_init(void) {
c01015c2:	f3 0f 1e fb          	endbr32 
c01015c6:	55                   	push   %ebp
c01015c7:	89 e5                	mov    %esp,%ebp
c01015c9:	83 ec 28             	sub    $0x28,%esp
c01015cc:	66 c7 45 ee 43 00    	movw   $0x43,-0x12(%ebp)
c01015d2:	c6 45 ed 34          	movb   $0x34,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01015d6:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01015da:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c01015de:	ee                   	out    %al,(%dx)
}
c01015df:	90                   	nop
c01015e0:	66 c7 45 f2 40 00    	movw   $0x40,-0xe(%ebp)
c01015e6:	c6 45 f1 9c          	movb   $0x9c,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01015ea:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c01015ee:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01015f2:	ee                   	out    %al,(%dx)
}
c01015f3:	90                   	nop
c01015f4:	66 c7 45 f6 40 00    	movw   $0x40,-0xa(%ebp)
c01015fa:	c6 45 f5 2e          	movb   $0x2e,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01015fe:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101602:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101606:	ee                   	out    %al,(%dx)
}
c0101607:	90                   	nop
    outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
    outb(IO_TIMER1, TIMER_DIV(100) % 256);
    outb(IO_TIMER1, TIMER_DIV(100) / 256);

    // initialize time counter 'ticks' to zero
    ticks = 0;
c0101608:	c7 05 54 e0 12 c0 00 	movl   $0x0,0xc012e054
c010160f:	00 00 00 

    cprintf("++ setup timer interrupts\n");
c0101612:	c7 04 24 5e a4 10 c0 	movl   $0xc010a45e,(%esp)
c0101619:	e8 b3 ec ff ff       	call   c01002d1 <cprintf>
    pic_enable(IRQ_TIMER);
c010161e:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0101625:	e8 95 09 00 00       	call   c0101fbf <pic_enable>
}
c010162a:	90                   	nop
c010162b:	c9                   	leave  
c010162c:	c3                   	ret    

c010162d <__intr_save>:
#include <x86.h>
#include <intr.h>
#include <mmu.h>

static inline bool
__intr_save(void) {
c010162d:	55                   	push   %ebp
c010162e:	89 e5                	mov    %esp,%ebp
c0101630:	83 ec 18             	sub    $0x18,%esp
}

static inline uint32_t
read_eflags(void) {
    uint32_t eflags;
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0101633:	9c                   	pushf  
c0101634:	58                   	pop    %eax
c0101635:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0101638:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c010163b:	25 00 02 00 00       	and    $0x200,%eax
c0101640:	85 c0                	test   %eax,%eax
c0101642:	74 0c                	je     c0101650 <__intr_save+0x23>
        intr_disable();
c0101644:	e8 05 0b 00 00       	call   c010214e <intr_disable>
        return 1;
c0101649:	b8 01 00 00 00       	mov    $0x1,%eax
c010164e:	eb 05                	jmp    c0101655 <__intr_save+0x28>
    }
    return 0;
c0101650:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0101655:	c9                   	leave  
c0101656:	c3                   	ret    

c0101657 <__intr_restore>:

static inline void
__intr_restore(bool flag) {
c0101657:	55                   	push   %ebp
c0101658:	89 e5                	mov    %esp,%ebp
c010165a:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c010165d:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0101661:	74 05                	je     c0101668 <__intr_restore+0x11>
        intr_enable();
c0101663:	e8 da 0a 00 00       	call   c0102142 <intr_enable>
    }
}
c0101668:	90                   	nop
c0101669:	c9                   	leave  
c010166a:	c3                   	ret    

c010166b <delay>:
#include <memlayout.h>
#include <sync.h>

/* stupid I/O delay routine necessitated by historical PC design flaws */
static void
delay(void) {
c010166b:	f3 0f 1e fb          	endbr32 
c010166f:	55                   	push   %ebp
c0101670:	89 e5                	mov    %esp,%ebp
c0101672:	83 ec 10             	sub    $0x10,%esp
c0101675:	66 c7 45 f2 84 00    	movw   $0x84,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010167b:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c010167f:	89 c2                	mov    %eax,%edx
c0101681:	ec                   	in     (%dx),%al
c0101682:	88 45 f1             	mov    %al,-0xf(%ebp)
c0101685:	66 c7 45 f6 84 00    	movw   $0x84,-0xa(%ebp)
c010168b:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c010168f:	89 c2                	mov    %eax,%edx
c0101691:	ec                   	in     (%dx),%al
c0101692:	88 45 f5             	mov    %al,-0xb(%ebp)
c0101695:	66 c7 45 fa 84 00    	movw   $0x84,-0x6(%ebp)
c010169b:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c010169f:	89 c2                	mov    %eax,%edx
c01016a1:	ec                   	in     (%dx),%al
c01016a2:	88 45 f9             	mov    %al,-0x7(%ebp)
c01016a5:	66 c7 45 fe 84 00    	movw   $0x84,-0x2(%ebp)
c01016ab:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c01016af:	89 c2                	mov    %eax,%edx
c01016b1:	ec                   	in     (%dx),%al
c01016b2:	88 45 fd             	mov    %al,-0x3(%ebp)
    inb(0x84);
    inb(0x84);
    inb(0x84);
    inb(0x84);
}
c01016b5:	90                   	nop
c01016b6:	c9                   	leave  
c01016b7:	c3                   	ret    

c01016b8 <cga_init>:
static uint16_t addr_6845;

/* TEXT-mode CGA/VGA display output */

static void
cga_init(void) {
c01016b8:	f3 0f 1e fb          	endbr32 
c01016bc:	55                   	push   %ebp
c01016bd:	89 e5                	mov    %esp,%ebp
c01016bf:	83 ec 20             	sub    $0x20,%esp
    volatile uint16_t *cp = (uint16_t *)(CGA_BUF + KERNBASE);
c01016c2:	c7 45 fc 00 80 0b c0 	movl   $0xc00b8000,-0x4(%ebp)
    uint16_t was = *cp;
c01016c9:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01016cc:	0f b7 00             	movzwl (%eax),%eax
c01016cf:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
    *cp = (uint16_t) 0xA55A;
c01016d3:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01016d6:	66 c7 00 5a a5       	movw   $0xa55a,(%eax)
    if (*cp != 0xA55A) {
c01016db:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01016de:	0f b7 00             	movzwl (%eax),%eax
c01016e1:	0f b7 c0             	movzwl %ax,%eax
c01016e4:	3d 5a a5 00 00       	cmp    $0xa55a,%eax
c01016e9:	74 12                	je     c01016fd <cga_init+0x45>
        cp = (uint16_t*)(MONO_BUF + KERNBASE);
c01016eb:	c7 45 fc 00 00 0b c0 	movl   $0xc00b0000,-0x4(%ebp)
        addr_6845 = MONO_BASE;
c01016f2:	66 c7 05 26 b5 12 c0 	movw   $0x3b4,0xc012b526
c01016f9:	b4 03 
c01016fb:	eb 13                	jmp    c0101710 <cga_init+0x58>
    } else {
        *cp = was;
c01016fd:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0101700:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0101704:	66 89 10             	mov    %dx,(%eax)
        addr_6845 = CGA_BASE;
c0101707:	66 c7 05 26 b5 12 c0 	movw   $0x3d4,0xc012b526
c010170e:	d4 03 
    }

    // Extract cursor location
    uint32_t pos;
    outb(addr_6845, 14);
c0101710:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c0101717:	66 89 45 e6          	mov    %ax,-0x1a(%ebp)
c010171b:	c6 45 e5 0e          	movb   $0xe,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010171f:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101723:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101727:	ee                   	out    %al,(%dx)
}
c0101728:	90                   	nop
    pos = inb(addr_6845 + 1) << 8;
c0101729:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c0101730:	40                   	inc    %eax
c0101731:	0f b7 c0             	movzwl %ax,%eax
c0101734:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101738:	0f b7 45 ea          	movzwl -0x16(%ebp),%eax
c010173c:	89 c2                	mov    %eax,%edx
c010173e:	ec                   	in     (%dx),%al
c010173f:	88 45 e9             	mov    %al,-0x17(%ebp)
    return data;
c0101742:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101746:	0f b6 c0             	movzbl %al,%eax
c0101749:	c1 e0 08             	shl    $0x8,%eax
c010174c:	89 45 f4             	mov    %eax,-0xc(%ebp)
    outb(addr_6845, 15);
c010174f:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c0101756:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c010175a:	c6 45 ed 0f          	movb   $0xf,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010175e:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101762:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101766:	ee                   	out    %al,(%dx)
}
c0101767:	90                   	nop
    pos |= inb(addr_6845 + 1);
c0101768:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c010176f:	40                   	inc    %eax
c0101770:	0f b7 c0             	movzwl %ax,%eax
c0101773:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101777:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c010177b:	89 c2                	mov    %eax,%edx
c010177d:	ec                   	in     (%dx),%al
c010177e:	88 45 f1             	mov    %al,-0xf(%ebp)
    return data;
c0101781:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0101785:	0f b6 c0             	movzbl %al,%eax
c0101788:	09 45 f4             	or     %eax,-0xc(%ebp)

    crt_buf = (uint16_t*) cp;
c010178b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010178e:	a3 20 b5 12 c0       	mov    %eax,0xc012b520
    crt_pos = pos;
c0101793:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101796:	0f b7 c0             	movzwl %ax,%eax
c0101799:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
}
c010179f:	90                   	nop
c01017a0:	c9                   	leave  
c01017a1:	c3                   	ret    

c01017a2 <serial_init>:

static bool serial_exists = 0;

static void
serial_init(void) {
c01017a2:	f3 0f 1e fb          	endbr32 
c01017a6:	55                   	push   %ebp
c01017a7:	89 e5                	mov    %esp,%ebp
c01017a9:	83 ec 48             	sub    $0x48,%esp
c01017ac:	66 c7 45 d2 fa 03    	movw   $0x3fa,-0x2e(%ebp)
c01017b2:	c6 45 d1 00          	movb   $0x0,-0x2f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01017b6:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c01017ba:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c01017be:	ee                   	out    %al,(%dx)
}
c01017bf:	90                   	nop
c01017c0:	66 c7 45 d6 fb 03    	movw   $0x3fb,-0x2a(%ebp)
c01017c6:	c6 45 d5 80          	movb   $0x80,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01017ca:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c01017ce:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c01017d2:	ee                   	out    %al,(%dx)
}
c01017d3:	90                   	nop
c01017d4:	66 c7 45 da f8 03    	movw   $0x3f8,-0x26(%ebp)
c01017da:	c6 45 d9 0c          	movb   $0xc,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01017de:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c01017e2:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c01017e6:	ee                   	out    %al,(%dx)
}
c01017e7:	90                   	nop
c01017e8:	66 c7 45 de f9 03    	movw   $0x3f9,-0x22(%ebp)
c01017ee:	c6 45 dd 00          	movb   $0x0,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01017f2:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c01017f6:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c01017fa:	ee                   	out    %al,(%dx)
}
c01017fb:	90                   	nop
c01017fc:	66 c7 45 e2 fb 03    	movw   $0x3fb,-0x1e(%ebp)
c0101802:	c6 45 e1 03          	movb   $0x3,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101806:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c010180a:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c010180e:	ee                   	out    %al,(%dx)
}
c010180f:	90                   	nop
c0101810:	66 c7 45 e6 fc 03    	movw   $0x3fc,-0x1a(%ebp)
c0101816:	c6 45 e5 00          	movb   $0x0,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010181a:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c010181e:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101822:	ee                   	out    %al,(%dx)
}
c0101823:	90                   	nop
c0101824:	66 c7 45 ea f9 03    	movw   $0x3f9,-0x16(%ebp)
c010182a:	c6 45 e9 01          	movb   $0x1,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010182e:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101832:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101836:	ee                   	out    %al,(%dx)
}
c0101837:	90                   	nop
c0101838:	66 c7 45 ee fd 03    	movw   $0x3fd,-0x12(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010183e:	0f b7 45 ee          	movzwl -0x12(%ebp),%eax
c0101842:	89 c2                	mov    %eax,%edx
c0101844:	ec                   	in     (%dx),%al
c0101845:	88 45 ed             	mov    %al,-0x13(%ebp)
    return data;
c0101848:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
    // Enable rcv interrupts
    outb(COM1 + COM_IER, COM_IER_RDI);

    // Clear any preexisting overrun indications and interrupts
    // Serial port doesn't exist if COM_LSR returns 0xFF
    serial_exists = (inb(COM1 + COM_LSR) != 0xFF);
c010184c:	3c ff                	cmp    $0xff,%al
c010184e:	0f 95 c0             	setne  %al
c0101851:	0f b6 c0             	movzbl %al,%eax
c0101854:	a3 28 b5 12 c0       	mov    %eax,0xc012b528
c0101859:	66 c7 45 f2 fa 03    	movw   $0x3fa,-0xe(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c010185f:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
c0101863:	89 c2                	mov    %eax,%edx
c0101865:	ec                   	in     (%dx),%al
c0101866:	88 45 f1             	mov    %al,-0xf(%ebp)
c0101869:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
c010186f:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101873:	89 c2                	mov    %eax,%edx
c0101875:	ec                   	in     (%dx),%al
c0101876:	88 45 f5             	mov    %al,-0xb(%ebp)
    (void) inb(COM1+COM_IIR);
    (void) inb(COM1+COM_RX);

    if (serial_exists) {
c0101879:	a1 28 b5 12 c0       	mov    0xc012b528,%eax
c010187e:	85 c0                	test   %eax,%eax
c0101880:	74 0c                	je     c010188e <serial_init+0xec>
        pic_enable(IRQ_COM1);
c0101882:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c0101889:	e8 31 07 00 00       	call   c0101fbf <pic_enable>
    }
}
c010188e:	90                   	nop
c010188f:	c9                   	leave  
c0101890:	c3                   	ret    

c0101891 <lpt_putc_sub>:

static void
lpt_putc_sub(int c) {
c0101891:	f3 0f 1e fb          	endbr32 
c0101895:	55                   	push   %ebp
c0101896:	89 e5                	mov    %esp,%ebp
c0101898:	83 ec 20             	sub    $0x20,%esp
    int i;
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c010189b:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c01018a2:	eb 08                	jmp    c01018ac <lpt_putc_sub+0x1b>
        delay();
c01018a4:	e8 c2 fd ff ff       	call   c010166b <delay>
    for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
c01018a9:	ff 45 fc             	incl   -0x4(%ebp)
c01018ac:	66 c7 45 fa 79 03    	movw   $0x379,-0x6(%ebp)
c01018b2:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c01018b6:	89 c2                	mov    %eax,%edx
c01018b8:	ec                   	in     (%dx),%al
c01018b9:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c01018bc:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c01018c0:	84 c0                	test   %al,%al
c01018c2:	78 09                	js     c01018cd <lpt_putc_sub+0x3c>
c01018c4:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c01018cb:	7e d7                	jle    c01018a4 <lpt_putc_sub+0x13>
    }
    outb(LPTPORT + 0, c);
c01018cd:	8b 45 08             	mov    0x8(%ebp),%eax
c01018d0:	0f b6 c0             	movzbl %al,%eax
c01018d3:	66 c7 45 ee 78 03    	movw   $0x378,-0x12(%ebp)
c01018d9:	88 45 ed             	mov    %al,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01018dc:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01018e0:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c01018e4:	ee                   	out    %al,(%dx)
}
c01018e5:	90                   	nop
c01018e6:	66 c7 45 f2 7a 03    	movw   $0x37a,-0xe(%ebp)
c01018ec:	c6 45 f1 0d          	movb   $0xd,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01018f0:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c01018f4:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01018f8:	ee                   	out    %al,(%dx)
}
c01018f9:	90                   	nop
c01018fa:	66 c7 45 f6 7a 03    	movw   $0x37a,-0xa(%ebp)
c0101900:	c6 45 f5 08          	movb   $0x8,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101904:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101908:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c010190c:	ee                   	out    %al,(%dx)
}
c010190d:	90                   	nop
    outb(LPTPORT + 2, 0x08 | 0x04 | 0x01);
    outb(LPTPORT + 2, 0x08);
}
c010190e:	90                   	nop
c010190f:	c9                   	leave  
c0101910:	c3                   	ret    

c0101911 <lpt_putc>:

/* lpt_putc - copy console output to parallel port */
static void
lpt_putc(int c) {
c0101911:	f3 0f 1e fb          	endbr32 
c0101915:	55                   	push   %ebp
c0101916:	89 e5                	mov    %esp,%ebp
c0101918:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c010191b:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c010191f:	74 0d                	je     c010192e <lpt_putc+0x1d>
        lpt_putc_sub(c);
c0101921:	8b 45 08             	mov    0x8(%ebp),%eax
c0101924:	89 04 24             	mov    %eax,(%esp)
c0101927:	e8 65 ff ff ff       	call   c0101891 <lpt_putc_sub>
    else {
        lpt_putc_sub('\b');
        lpt_putc_sub(' ');
        lpt_putc_sub('\b');
    }
}
c010192c:	eb 24                	jmp    c0101952 <lpt_putc+0x41>
        lpt_putc_sub('\b');
c010192e:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101935:	e8 57 ff ff ff       	call   c0101891 <lpt_putc_sub>
        lpt_putc_sub(' ');
c010193a:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0101941:	e8 4b ff ff ff       	call   c0101891 <lpt_putc_sub>
        lpt_putc_sub('\b');
c0101946:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c010194d:	e8 3f ff ff ff       	call   c0101891 <lpt_putc_sub>
}
c0101952:	90                   	nop
c0101953:	c9                   	leave  
c0101954:	c3                   	ret    

c0101955 <cga_putc>:

/* cga_putc - print character to console */
static void
cga_putc(int c) {
c0101955:	f3 0f 1e fb          	endbr32 
c0101959:	55                   	push   %ebp
c010195a:	89 e5                	mov    %esp,%ebp
c010195c:	53                   	push   %ebx
c010195d:	83 ec 34             	sub    $0x34,%esp
    // set black on white
    if (!(c & ~0xFF)) {
c0101960:	8b 45 08             	mov    0x8(%ebp),%eax
c0101963:	25 00 ff ff ff       	and    $0xffffff00,%eax
c0101968:	85 c0                	test   %eax,%eax
c010196a:	75 07                	jne    c0101973 <cga_putc+0x1e>
        c |= 0x0700;
c010196c:	81 4d 08 00 07 00 00 	orl    $0x700,0x8(%ebp)
    }

    switch (c & 0xff) {
c0101973:	8b 45 08             	mov    0x8(%ebp),%eax
c0101976:	0f b6 c0             	movzbl %al,%eax
c0101979:	83 f8 0d             	cmp    $0xd,%eax
c010197c:	74 72                	je     c01019f0 <cga_putc+0x9b>
c010197e:	83 f8 0d             	cmp    $0xd,%eax
c0101981:	0f 8f a3 00 00 00    	jg     c0101a2a <cga_putc+0xd5>
c0101987:	83 f8 08             	cmp    $0x8,%eax
c010198a:	74 0a                	je     c0101996 <cga_putc+0x41>
c010198c:	83 f8 0a             	cmp    $0xa,%eax
c010198f:	74 4c                	je     c01019dd <cga_putc+0x88>
c0101991:	e9 94 00 00 00       	jmp    c0101a2a <cga_putc+0xd5>
    case '\b':
        if (crt_pos > 0) {
c0101996:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c010199d:	85 c0                	test   %eax,%eax
c010199f:	0f 84 af 00 00 00    	je     c0101a54 <cga_putc+0xff>
            crt_pos --;
c01019a5:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c01019ac:	48                   	dec    %eax
c01019ad:	0f b7 c0             	movzwl %ax,%eax
c01019b0:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
            crt_buf[crt_pos] = (c & ~0xff) | ' ';
c01019b6:	8b 45 08             	mov    0x8(%ebp),%eax
c01019b9:	98                   	cwtl   
c01019ba:	25 00 ff ff ff       	and    $0xffffff00,%eax
c01019bf:	98                   	cwtl   
c01019c0:	83 c8 20             	or     $0x20,%eax
c01019c3:	98                   	cwtl   
c01019c4:	8b 15 20 b5 12 c0    	mov    0xc012b520,%edx
c01019ca:	0f b7 0d 24 b5 12 c0 	movzwl 0xc012b524,%ecx
c01019d1:	01 c9                	add    %ecx,%ecx
c01019d3:	01 ca                	add    %ecx,%edx
c01019d5:	0f b7 c0             	movzwl %ax,%eax
c01019d8:	66 89 02             	mov    %ax,(%edx)
        }
        break;
c01019db:	eb 77                	jmp    c0101a54 <cga_putc+0xff>
    case '\n':
        crt_pos += CRT_COLS;
c01019dd:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c01019e4:	83 c0 50             	add    $0x50,%eax
c01019e7:	0f b7 c0             	movzwl %ax,%eax
c01019ea:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
    case '\r':
        crt_pos -= (crt_pos % CRT_COLS);
c01019f0:	0f b7 1d 24 b5 12 c0 	movzwl 0xc012b524,%ebx
c01019f7:	0f b7 0d 24 b5 12 c0 	movzwl 0xc012b524,%ecx
c01019fe:	ba cd cc cc cc       	mov    $0xcccccccd,%edx
c0101a03:	89 c8                	mov    %ecx,%eax
c0101a05:	f7 e2                	mul    %edx
c0101a07:	c1 ea 06             	shr    $0x6,%edx
c0101a0a:	89 d0                	mov    %edx,%eax
c0101a0c:	c1 e0 02             	shl    $0x2,%eax
c0101a0f:	01 d0                	add    %edx,%eax
c0101a11:	c1 e0 04             	shl    $0x4,%eax
c0101a14:	29 c1                	sub    %eax,%ecx
c0101a16:	89 c8                	mov    %ecx,%eax
c0101a18:	0f b7 c0             	movzwl %ax,%eax
c0101a1b:	29 c3                	sub    %eax,%ebx
c0101a1d:	89 d8                	mov    %ebx,%eax
c0101a1f:	0f b7 c0             	movzwl %ax,%eax
c0101a22:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
        break;
c0101a28:	eb 2b                	jmp    c0101a55 <cga_putc+0x100>
    default:
        crt_buf[crt_pos ++] = c;     // write the character
c0101a2a:	8b 0d 20 b5 12 c0    	mov    0xc012b520,%ecx
c0101a30:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101a37:	8d 50 01             	lea    0x1(%eax),%edx
c0101a3a:	0f b7 d2             	movzwl %dx,%edx
c0101a3d:	66 89 15 24 b5 12 c0 	mov    %dx,0xc012b524
c0101a44:	01 c0                	add    %eax,%eax
c0101a46:	8d 14 01             	lea    (%ecx,%eax,1),%edx
c0101a49:	8b 45 08             	mov    0x8(%ebp),%eax
c0101a4c:	0f b7 c0             	movzwl %ax,%eax
c0101a4f:	66 89 02             	mov    %ax,(%edx)
        break;
c0101a52:	eb 01                	jmp    c0101a55 <cga_putc+0x100>
        break;
c0101a54:	90                   	nop
    }

    // What is the purpose of this?
    if (crt_pos >= CRT_SIZE) {
c0101a55:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101a5c:	3d cf 07 00 00       	cmp    $0x7cf,%eax
c0101a61:	76 5d                	jbe    c0101ac0 <cga_putc+0x16b>
        int i;
        memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
c0101a63:	a1 20 b5 12 c0       	mov    0xc012b520,%eax
c0101a68:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
c0101a6e:	a1 20 b5 12 c0       	mov    0xc012b520,%eax
c0101a73:	c7 44 24 08 00 0f 00 	movl   $0xf00,0x8(%esp)
c0101a7a:	00 
c0101a7b:	89 54 24 04          	mov    %edx,0x4(%esp)
c0101a7f:	89 04 24             	mov    %eax,(%esp)
c0101a82:	e8 fa 7c 00 00       	call   c0109781 <memmove>
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101a87:	c7 45 f4 80 07 00 00 	movl   $0x780,-0xc(%ebp)
c0101a8e:	eb 14                	jmp    c0101aa4 <cga_putc+0x14f>
            crt_buf[i] = 0x0700 | ' ';
c0101a90:	a1 20 b5 12 c0       	mov    0xc012b520,%eax
c0101a95:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101a98:	01 d2                	add    %edx,%edx
c0101a9a:	01 d0                	add    %edx,%eax
c0101a9c:	66 c7 00 20 07       	movw   $0x720,(%eax)
        for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
c0101aa1:	ff 45 f4             	incl   -0xc(%ebp)
c0101aa4:	81 7d f4 cf 07 00 00 	cmpl   $0x7cf,-0xc(%ebp)
c0101aab:	7e e3                	jle    c0101a90 <cga_putc+0x13b>
        }
        crt_pos -= CRT_COLS;
c0101aad:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101ab4:	83 e8 50             	sub    $0x50,%eax
c0101ab7:	0f b7 c0             	movzwl %ax,%eax
c0101aba:	66 a3 24 b5 12 c0    	mov    %ax,0xc012b524
    }

    // move that little blinky thing
    outb(addr_6845, 14);
c0101ac0:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c0101ac7:	66 89 45 e6          	mov    %ax,-0x1a(%ebp)
c0101acb:	c6 45 e5 0e          	movb   $0xe,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101acf:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c0101ad3:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c0101ad7:	ee                   	out    %al,(%dx)
}
c0101ad8:	90                   	nop
    outb(addr_6845 + 1, crt_pos >> 8);
c0101ad9:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101ae0:	c1 e8 08             	shr    $0x8,%eax
c0101ae3:	0f b7 c0             	movzwl %ax,%eax
c0101ae6:	0f b6 c0             	movzbl %al,%eax
c0101ae9:	0f b7 15 26 b5 12 c0 	movzwl 0xc012b526,%edx
c0101af0:	42                   	inc    %edx
c0101af1:	0f b7 d2             	movzwl %dx,%edx
c0101af4:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
c0101af8:	88 45 e9             	mov    %al,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101afb:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c0101aff:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c0101b03:	ee                   	out    %al,(%dx)
}
c0101b04:	90                   	nop
    outb(addr_6845, 15);
c0101b05:	0f b7 05 26 b5 12 c0 	movzwl 0xc012b526,%eax
c0101b0c:	66 89 45 ee          	mov    %ax,-0x12(%ebp)
c0101b10:	c6 45 ed 0f          	movb   $0xf,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101b14:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c0101b18:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c0101b1c:	ee                   	out    %al,(%dx)
}
c0101b1d:	90                   	nop
    outb(addr_6845 + 1, crt_pos);
c0101b1e:	0f b7 05 24 b5 12 c0 	movzwl 0xc012b524,%eax
c0101b25:	0f b6 c0             	movzbl %al,%eax
c0101b28:	0f b7 15 26 b5 12 c0 	movzwl 0xc012b526,%edx
c0101b2f:	42                   	inc    %edx
c0101b30:	0f b7 d2             	movzwl %dx,%edx
c0101b33:	66 89 55 f2          	mov    %dx,-0xe(%ebp)
c0101b37:	88 45 f1             	mov    %al,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101b3a:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c0101b3e:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c0101b42:	ee                   	out    %al,(%dx)
}
c0101b43:	90                   	nop
}
c0101b44:	90                   	nop
c0101b45:	83 c4 34             	add    $0x34,%esp
c0101b48:	5b                   	pop    %ebx
c0101b49:	5d                   	pop    %ebp
c0101b4a:	c3                   	ret    

c0101b4b <serial_putc_sub>:

static void
serial_putc_sub(int c) {
c0101b4b:	f3 0f 1e fb          	endbr32 
c0101b4f:	55                   	push   %ebp
c0101b50:	89 e5                	mov    %esp,%ebp
c0101b52:	83 ec 10             	sub    $0x10,%esp
    int i;
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c0101b55:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c0101b5c:	eb 08                	jmp    c0101b66 <serial_putc_sub+0x1b>
        delay();
c0101b5e:	e8 08 fb ff ff       	call   c010166b <delay>
    for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
c0101b63:	ff 45 fc             	incl   -0x4(%ebp)
c0101b66:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101b6c:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101b70:	89 c2                	mov    %eax,%edx
c0101b72:	ec                   	in     (%dx),%al
c0101b73:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101b76:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101b7a:	0f b6 c0             	movzbl %al,%eax
c0101b7d:	83 e0 20             	and    $0x20,%eax
c0101b80:	85 c0                	test   %eax,%eax
c0101b82:	75 09                	jne    c0101b8d <serial_putc_sub+0x42>
c0101b84:	81 7d fc ff 31 00 00 	cmpl   $0x31ff,-0x4(%ebp)
c0101b8b:	7e d1                	jle    c0101b5e <serial_putc_sub+0x13>
    }
    outb(COM1 + COM_TX, c);
c0101b8d:	8b 45 08             	mov    0x8(%ebp),%eax
c0101b90:	0f b6 c0             	movzbl %al,%eax
c0101b93:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
c0101b99:	88 45 f5             	mov    %al,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101b9c:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c0101ba0:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c0101ba4:	ee                   	out    %al,(%dx)
}
c0101ba5:	90                   	nop
}
c0101ba6:	90                   	nop
c0101ba7:	c9                   	leave  
c0101ba8:	c3                   	ret    

c0101ba9 <serial_putc>:

/* serial_putc - print character to serial port */
static void
serial_putc(int c) {
c0101ba9:	f3 0f 1e fb          	endbr32 
c0101bad:	55                   	push   %ebp
c0101bae:	89 e5                	mov    %esp,%ebp
c0101bb0:	83 ec 04             	sub    $0x4,%esp
    if (c != '\b') {
c0101bb3:	83 7d 08 08          	cmpl   $0x8,0x8(%ebp)
c0101bb7:	74 0d                	je     c0101bc6 <serial_putc+0x1d>
        serial_putc_sub(c);
c0101bb9:	8b 45 08             	mov    0x8(%ebp),%eax
c0101bbc:	89 04 24             	mov    %eax,(%esp)
c0101bbf:	e8 87 ff ff ff       	call   c0101b4b <serial_putc_sub>
    else {
        serial_putc_sub('\b');
        serial_putc_sub(' ');
        serial_putc_sub('\b');
    }
}
c0101bc4:	eb 24                	jmp    c0101bea <serial_putc+0x41>
        serial_putc_sub('\b');
c0101bc6:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101bcd:	e8 79 ff ff ff       	call   c0101b4b <serial_putc_sub>
        serial_putc_sub(' ');
c0101bd2:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0101bd9:	e8 6d ff ff ff       	call   c0101b4b <serial_putc_sub>
        serial_putc_sub('\b');
c0101bde:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
c0101be5:	e8 61 ff ff ff       	call   c0101b4b <serial_putc_sub>
}
c0101bea:	90                   	nop
c0101beb:	c9                   	leave  
c0101bec:	c3                   	ret    

c0101bed <cons_intr>:
/* *
 * cons_intr - called by device interrupt routines to feed input
 * characters into the circular console input buffer.
 * */
static void
cons_intr(int (*proc)(void)) {
c0101bed:	f3 0f 1e fb          	endbr32 
c0101bf1:	55                   	push   %ebp
c0101bf2:	89 e5                	mov    %esp,%ebp
c0101bf4:	83 ec 18             	sub    $0x18,%esp
    int c;
    while ((c = (*proc)()) != -1) {
c0101bf7:	eb 33                	jmp    c0101c2c <cons_intr+0x3f>
        if (c != 0) {
c0101bf9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0101bfd:	74 2d                	je     c0101c2c <cons_intr+0x3f>
            cons.buf[cons.wpos ++] = c;
c0101bff:	a1 44 b7 12 c0       	mov    0xc012b744,%eax
c0101c04:	8d 50 01             	lea    0x1(%eax),%edx
c0101c07:	89 15 44 b7 12 c0    	mov    %edx,0xc012b744
c0101c0d:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0101c10:	88 90 40 b5 12 c0    	mov    %dl,-0x3fed4ac0(%eax)
            if (cons.wpos == CONSBUFSIZE) {
c0101c16:	a1 44 b7 12 c0       	mov    0xc012b744,%eax
c0101c1b:	3d 00 02 00 00       	cmp    $0x200,%eax
c0101c20:	75 0a                	jne    c0101c2c <cons_intr+0x3f>
                cons.wpos = 0;
c0101c22:	c7 05 44 b7 12 c0 00 	movl   $0x0,0xc012b744
c0101c29:	00 00 00 
    while ((c = (*proc)()) != -1) {
c0101c2c:	8b 45 08             	mov    0x8(%ebp),%eax
c0101c2f:	ff d0                	call   *%eax
c0101c31:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0101c34:	83 7d f4 ff          	cmpl   $0xffffffff,-0xc(%ebp)
c0101c38:	75 bf                	jne    c0101bf9 <cons_intr+0xc>
            }
        }
    }
}
c0101c3a:	90                   	nop
c0101c3b:	90                   	nop
c0101c3c:	c9                   	leave  
c0101c3d:	c3                   	ret    

c0101c3e <serial_proc_data>:

/* serial_proc_data - get data from serial port */
static int
serial_proc_data(void) {
c0101c3e:	f3 0f 1e fb          	endbr32 
c0101c42:	55                   	push   %ebp
c0101c43:	89 e5                	mov    %esp,%ebp
c0101c45:	83 ec 10             	sub    $0x10,%esp
c0101c48:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101c4e:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
c0101c52:	89 c2                	mov    %eax,%edx
c0101c54:	ec                   	in     (%dx),%al
c0101c55:	88 45 f9             	mov    %al,-0x7(%ebp)
    return data;
c0101c58:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
    if (!(inb(COM1 + COM_LSR) & COM_LSR_DATA)) {
c0101c5c:	0f b6 c0             	movzbl %al,%eax
c0101c5f:	83 e0 01             	and    $0x1,%eax
c0101c62:	85 c0                	test   %eax,%eax
c0101c64:	75 07                	jne    c0101c6d <serial_proc_data+0x2f>
        return -1;
c0101c66:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101c6b:	eb 2a                	jmp    c0101c97 <serial_proc_data+0x59>
c0101c6d:	66 c7 45 f6 f8 03    	movw   $0x3f8,-0xa(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101c73:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
c0101c77:	89 c2                	mov    %eax,%edx
c0101c79:	ec                   	in     (%dx),%al
c0101c7a:	88 45 f5             	mov    %al,-0xb(%ebp)
    return data;
c0101c7d:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
    }
    int c = inb(COM1 + COM_RX);
c0101c81:	0f b6 c0             	movzbl %al,%eax
c0101c84:	89 45 fc             	mov    %eax,-0x4(%ebp)
    if (c == 127) {
c0101c87:	83 7d fc 7f          	cmpl   $0x7f,-0x4(%ebp)
c0101c8b:	75 07                	jne    c0101c94 <serial_proc_data+0x56>
        c = '\b';
c0101c8d:	c7 45 fc 08 00 00 00 	movl   $0x8,-0x4(%ebp)
    }
    return c;
c0101c94:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0101c97:	c9                   	leave  
c0101c98:	c3                   	ret    

c0101c99 <serial_intr>:

/* serial_intr - try to feed input characters from serial port */
void
serial_intr(void) {
c0101c99:	f3 0f 1e fb          	endbr32 
c0101c9d:	55                   	push   %ebp
c0101c9e:	89 e5                	mov    %esp,%ebp
c0101ca0:	83 ec 18             	sub    $0x18,%esp
    if (serial_exists) {
c0101ca3:	a1 28 b5 12 c0       	mov    0xc012b528,%eax
c0101ca8:	85 c0                	test   %eax,%eax
c0101caa:	74 0c                	je     c0101cb8 <serial_intr+0x1f>
        cons_intr(serial_proc_data);
c0101cac:	c7 04 24 3e 1c 10 c0 	movl   $0xc0101c3e,(%esp)
c0101cb3:	e8 35 ff ff ff       	call   c0101bed <cons_intr>
    }
}
c0101cb8:	90                   	nop
c0101cb9:	c9                   	leave  
c0101cba:	c3                   	ret    

c0101cbb <kbd_proc_data>:
 *
 * The kbd_proc_data() function gets data from the keyboard.
 * If we finish a character, return it, else 0. And return -1 if no data.
 * */
static int
kbd_proc_data(void) {
c0101cbb:	f3 0f 1e fb          	endbr32 
c0101cbf:	55                   	push   %ebp
c0101cc0:	89 e5                	mov    %esp,%ebp
c0101cc2:	83 ec 38             	sub    $0x38,%esp
c0101cc5:	66 c7 45 f0 64 00    	movw   $0x64,-0x10(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101ccb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101cce:	89 c2                	mov    %eax,%edx
c0101cd0:	ec                   	in     (%dx),%al
c0101cd1:	88 45 ef             	mov    %al,-0x11(%ebp)
    return data;
c0101cd4:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
    int c;
    uint8_t data;
    static uint32_t shift;

    if ((inb(KBSTATP) & KBS_DIB) == 0) {
c0101cd8:	0f b6 c0             	movzbl %al,%eax
c0101cdb:	83 e0 01             	and    $0x1,%eax
c0101cde:	85 c0                	test   %eax,%eax
c0101ce0:	75 0a                	jne    c0101cec <kbd_proc_data+0x31>
        return -1;
c0101ce2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
c0101ce7:	e9 56 01 00 00       	jmp    c0101e42 <kbd_proc_data+0x187>
c0101cec:	66 c7 45 ec 60 00    	movw   $0x60,-0x14(%ebp)
    asm volatile ("inb %1, %0" : "=a" (data) : "d" (port) : "memory");
c0101cf2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101cf5:	89 c2                	mov    %eax,%edx
c0101cf7:	ec                   	in     (%dx),%al
c0101cf8:	88 45 eb             	mov    %al,-0x15(%ebp)
    return data;
c0101cfb:	0f b6 45 eb          	movzbl -0x15(%ebp),%eax
    }

    data = inb(KBDATAP);
c0101cff:	88 45 f3             	mov    %al,-0xd(%ebp)

    if (data == 0xE0) {
c0101d02:	80 7d f3 e0          	cmpb   $0xe0,-0xd(%ebp)
c0101d06:	75 17                	jne    c0101d1f <kbd_proc_data+0x64>
        // E0 escape character
        shift |= E0ESC;
c0101d08:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101d0d:	83 c8 40             	or     $0x40,%eax
c0101d10:	a3 48 b7 12 c0       	mov    %eax,0xc012b748
        return 0;
c0101d15:	b8 00 00 00 00       	mov    $0x0,%eax
c0101d1a:	e9 23 01 00 00       	jmp    c0101e42 <kbd_proc_data+0x187>
    } else if (data & 0x80) {
c0101d1f:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101d23:	84 c0                	test   %al,%al
c0101d25:	79 45                	jns    c0101d6c <kbd_proc_data+0xb1>
        // Key released
        data = (shift & E0ESC ? data : data & 0x7F);
c0101d27:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101d2c:	83 e0 40             	and    $0x40,%eax
c0101d2f:	85 c0                	test   %eax,%eax
c0101d31:	75 08                	jne    c0101d3b <kbd_proc_data+0x80>
c0101d33:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101d37:	24 7f                	and    $0x7f,%al
c0101d39:	eb 04                	jmp    c0101d3f <kbd_proc_data+0x84>
c0101d3b:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101d3f:	88 45 f3             	mov    %al,-0xd(%ebp)
        shift &= ~(shiftcode[data] | E0ESC);
c0101d42:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101d46:	0f b6 80 40 80 12 c0 	movzbl -0x3fed7fc0(%eax),%eax
c0101d4d:	0c 40                	or     $0x40,%al
c0101d4f:	0f b6 c0             	movzbl %al,%eax
c0101d52:	f7 d0                	not    %eax
c0101d54:	89 c2                	mov    %eax,%edx
c0101d56:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101d5b:	21 d0                	and    %edx,%eax
c0101d5d:	a3 48 b7 12 c0       	mov    %eax,0xc012b748
        return 0;
c0101d62:	b8 00 00 00 00       	mov    $0x0,%eax
c0101d67:	e9 d6 00 00 00       	jmp    c0101e42 <kbd_proc_data+0x187>
    } else if (shift & E0ESC) {
c0101d6c:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101d71:	83 e0 40             	and    $0x40,%eax
c0101d74:	85 c0                	test   %eax,%eax
c0101d76:	74 11                	je     c0101d89 <kbd_proc_data+0xce>
        // Last character was an E0 escape; or with 0x80
        data |= 0x80;
c0101d78:	80 4d f3 80          	orb    $0x80,-0xd(%ebp)
        shift &= ~E0ESC;
c0101d7c:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101d81:	83 e0 bf             	and    $0xffffffbf,%eax
c0101d84:	a3 48 b7 12 c0       	mov    %eax,0xc012b748
    }

    shift |= shiftcode[data];
c0101d89:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101d8d:	0f b6 80 40 80 12 c0 	movzbl -0x3fed7fc0(%eax),%eax
c0101d94:	0f b6 d0             	movzbl %al,%edx
c0101d97:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101d9c:	09 d0                	or     %edx,%eax
c0101d9e:	a3 48 b7 12 c0       	mov    %eax,0xc012b748
    shift ^= togglecode[data];
c0101da3:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101da7:	0f b6 80 40 81 12 c0 	movzbl -0x3fed7ec0(%eax),%eax
c0101dae:	0f b6 d0             	movzbl %al,%edx
c0101db1:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101db6:	31 d0                	xor    %edx,%eax
c0101db8:	a3 48 b7 12 c0       	mov    %eax,0xc012b748

    c = charcode[shift & (CTL | SHIFT)][data];
c0101dbd:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101dc2:	83 e0 03             	and    $0x3,%eax
c0101dc5:	8b 14 85 40 85 12 c0 	mov    -0x3fed7ac0(,%eax,4),%edx
c0101dcc:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
c0101dd0:	01 d0                	add    %edx,%eax
c0101dd2:	0f b6 00             	movzbl (%eax),%eax
c0101dd5:	0f b6 c0             	movzbl %al,%eax
c0101dd8:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (shift & CAPSLOCK) {
c0101ddb:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101de0:	83 e0 08             	and    $0x8,%eax
c0101de3:	85 c0                	test   %eax,%eax
c0101de5:	74 22                	je     c0101e09 <kbd_proc_data+0x14e>
        if ('a' <= c && c <= 'z')
c0101de7:	83 7d f4 60          	cmpl   $0x60,-0xc(%ebp)
c0101deb:	7e 0c                	jle    c0101df9 <kbd_proc_data+0x13e>
c0101ded:	83 7d f4 7a          	cmpl   $0x7a,-0xc(%ebp)
c0101df1:	7f 06                	jg     c0101df9 <kbd_proc_data+0x13e>
            c += 'A' - 'a';
c0101df3:	83 6d f4 20          	subl   $0x20,-0xc(%ebp)
c0101df7:	eb 10                	jmp    c0101e09 <kbd_proc_data+0x14e>
        else if ('A' <= c && c <= 'Z')
c0101df9:	83 7d f4 40          	cmpl   $0x40,-0xc(%ebp)
c0101dfd:	7e 0a                	jle    c0101e09 <kbd_proc_data+0x14e>
c0101dff:	83 7d f4 5a          	cmpl   $0x5a,-0xc(%ebp)
c0101e03:	7f 04                	jg     c0101e09 <kbd_proc_data+0x14e>
            c += 'a' - 'A';
c0101e05:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
    }

    // Process special keys
    // Ctrl-Alt-Del: reboot
    if (!(~shift & (CTL | ALT)) && c == KEY_DEL) {
c0101e09:	a1 48 b7 12 c0       	mov    0xc012b748,%eax
c0101e0e:	f7 d0                	not    %eax
c0101e10:	83 e0 06             	and    $0x6,%eax
c0101e13:	85 c0                	test   %eax,%eax
c0101e15:	75 28                	jne    c0101e3f <kbd_proc_data+0x184>
c0101e17:	81 7d f4 e9 00 00 00 	cmpl   $0xe9,-0xc(%ebp)
c0101e1e:	75 1f                	jne    c0101e3f <kbd_proc_data+0x184>
        cprintf("Rebooting!\n");
c0101e20:	c7 04 24 79 a4 10 c0 	movl   $0xc010a479,(%esp)
c0101e27:	e8 a5 e4 ff ff       	call   c01002d1 <cprintf>
c0101e2c:	66 c7 45 e8 92 00    	movw   $0x92,-0x18(%ebp)
c0101e32:	c6 45 e7 03          	movb   $0x3,-0x19(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101e36:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
c0101e3a:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0101e3d:	ee                   	out    %al,(%dx)
}
c0101e3e:	90                   	nop
        outb(0x92, 0x3); // courtesy of Chris Frost
    }
    return c;
c0101e3f:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101e42:	c9                   	leave  
c0101e43:	c3                   	ret    

c0101e44 <kbd_intr>:

/* kbd_intr - try to feed input characters from keyboard */
static void
kbd_intr(void) {
c0101e44:	f3 0f 1e fb          	endbr32 
c0101e48:	55                   	push   %ebp
c0101e49:	89 e5                	mov    %esp,%ebp
c0101e4b:	83 ec 18             	sub    $0x18,%esp
    cons_intr(kbd_proc_data);
c0101e4e:	c7 04 24 bb 1c 10 c0 	movl   $0xc0101cbb,(%esp)
c0101e55:	e8 93 fd ff ff       	call   c0101bed <cons_intr>
}
c0101e5a:	90                   	nop
c0101e5b:	c9                   	leave  
c0101e5c:	c3                   	ret    

c0101e5d <kbd_init>:

static void
kbd_init(void) {
c0101e5d:	f3 0f 1e fb          	endbr32 
c0101e61:	55                   	push   %ebp
c0101e62:	89 e5                	mov    %esp,%ebp
c0101e64:	83 ec 18             	sub    $0x18,%esp
    // drain the kbd buffer
    kbd_intr();
c0101e67:	e8 d8 ff ff ff       	call   c0101e44 <kbd_intr>
    pic_enable(IRQ_KBD);
c0101e6c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0101e73:	e8 47 01 00 00       	call   c0101fbf <pic_enable>
}
c0101e78:	90                   	nop
c0101e79:	c9                   	leave  
c0101e7a:	c3                   	ret    

c0101e7b <cons_init>:

/* cons_init - initializes the console devices */
void
cons_init(void) {
c0101e7b:	f3 0f 1e fb          	endbr32 
c0101e7f:	55                   	push   %ebp
c0101e80:	89 e5                	mov    %esp,%ebp
c0101e82:	83 ec 18             	sub    $0x18,%esp
    cga_init();
c0101e85:	e8 2e f8 ff ff       	call   c01016b8 <cga_init>
    serial_init();
c0101e8a:	e8 13 f9 ff ff       	call   c01017a2 <serial_init>
    kbd_init();
c0101e8f:	e8 c9 ff ff ff       	call   c0101e5d <kbd_init>
    if (!serial_exists) {
c0101e94:	a1 28 b5 12 c0       	mov    0xc012b528,%eax
c0101e99:	85 c0                	test   %eax,%eax
c0101e9b:	75 0c                	jne    c0101ea9 <cons_init+0x2e>
        cprintf("serial port does not exist!!\n");
c0101e9d:	c7 04 24 85 a4 10 c0 	movl   $0xc010a485,(%esp)
c0101ea4:	e8 28 e4 ff ff       	call   c01002d1 <cprintf>
    }
}
c0101ea9:	90                   	nop
c0101eaa:	c9                   	leave  
c0101eab:	c3                   	ret    

c0101eac <cons_putc>:

/* cons_putc - print a single character @c to console devices */
void
cons_putc(int c) {
c0101eac:	f3 0f 1e fb          	endbr32 
c0101eb0:	55                   	push   %ebp
c0101eb1:	89 e5                	mov    %esp,%ebp
c0101eb3:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c0101eb6:	e8 72 f7 ff ff       	call   c010162d <__intr_save>
c0101ebb:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        lpt_putc(c);
c0101ebe:	8b 45 08             	mov    0x8(%ebp),%eax
c0101ec1:	89 04 24             	mov    %eax,(%esp)
c0101ec4:	e8 48 fa ff ff       	call   c0101911 <lpt_putc>
        cga_putc(c);
c0101ec9:	8b 45 08             	mov    0x8(%ebp),%eax
c0101ecc:	89 04 24             	mov    %eax,(%esp)
c0101ecf:	e8 81 fa ff ff       	call   c0101955 <cga_putc>
        serial_putc(c);
c0101ed4:	8b 45 08             	mov    0x8(%ebp),%eax
c0101ed7:	89 04 24             	mov    %eax,(%esp)
c0101eda:	e8 ca fc ff ff       	call   c0101ba9 <serial_putc>
    }
    local_intr_restore(intr_flag);
c0101edf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0101ee2:	89 04 24             	mov    %eax,(%esp)
c0101ee5:	e8 6d f7 ff ff       	call   c0101657 <__intr_restore>
}
c0101eea:	90                   	nop
c0101eeb:	c9                   	leave  
c0101eec:	c3                   	ret    

c0101eed <cons_getc>:
/* *
 * cons_getc - return the next input character from console,
 * or 0 if none waiting.
 * */
int
cons_getc(void) {
c0101eed:	f3 0f 1e fb          	endbr32 
c0101ef1:	55                   	push   %ebp
c0101ef2:	89 e5                	mov    %esp,%ebp
c0101ef4:	83 ec 28             	sub    $0x28,%esp
    int c = 0;
c0101ef7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    local_intr_save(intr_flag);
c0101efe:	e8 2a f7 ff ff       	call   c010162d <__intr_save>
c0101f03:	89 45 f0             	mov    %eax,-0x10(%ebp)
    {
        // poll for any pending input characters,
        // so that this function works even when interrupts are disabled
        // (e.g., when called from the kernel monitor).
        serial_intr();
c0101f06:	e8 8e fd ff ff       	call   c0101c99 <serial_intr>
        kbd_intr();
c0101f0b:	e8 34 ff ff ff       	call   c0101e44 <kbd_intr>

        // grab the next character from the input buffer.
        if (cons.rpos != cons.wpos) {
c0101f10:	8b 15 40 b7 12 c0    	mov    0xc012b740,%edx
c0101f16:	a1 44 b7 12 c0       	mov    0xc012b744,%eax
c0101f1b:	39 c2                	cmp    %eax,%edx
c0101f1d:	74 31                	je     c0101f50 <cons_getc+0x63>
            c = cons.buf[cons.rpos ++];
c0101f1f:	a1 40 b7 12 c0       	mov    0xc012b740,%eax
c0101f24:	8d 50 01             	lea    0x1(%eax),%edx
c0101f27:	89 15 40 b7 12 c0    	mov    %edx,0xc012b740
c0101f2d:	0f b6 80 40 b5 12 c0 	movzbl -0x3fed4ac0(%eax),%eax
c0101f34:	0f b6 c0             	movzbl %al,%eax
c0101f37:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (cons.rpos == CONSBUFSIZE) {
c0101f3a:	a1 40 b7 12 c0       	mov    0xc012b740,%eax
c0101f3f:	3d 00 02 00 00       	cmp    $0x200,%eax
c0101f44:	75 0a                	jne    c0101f50 <cons_getc+0x63>
                cons.rpos = 0;
c0101f46:	c7 05 40 b7 12 c0 00 	movl   $0x0,0xc012b740
c0101f4d:	00 00 00 
            }
        }
    }
    local_intr_restore(intr_flag);
c0101f50:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0101f53:	89 04 24             	mov    %eax,(%esp)
c0101f56:	e8 fc f6 ff ff       	call   c0101657 <__intr_restore>
    return c;
c0101f5b:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0101f5e:	c9                   	leave  
c0101f5f:	c3                   	ret    

c0101f60 <pic_setmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static uint16_t irq_mask = 0xFFFF & ~(1 << IRQ_SLAVE);
static bool did_init = 0;

static void
pic_setmask(uint16_t mask) {
c0101f60:	f3 0f 1e fb          	endbr32 
c0101f64:	55                   	push   %ebp
c0101f65:	89 e5                	mov    %esp,%ebp
c0101f67:	83 ec 14             	sub    $0x14,%esp
c0101f6a:	8b 45 08             	mov    0x8(%ebp),%eax
c0101f6d:	66 89 45 ec          	mov    %ax,-0x14(%ebp)
    irq_mask = mask;
c0101f71:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101f74:	66 a3 50 85 12 c0    	mov    %ax,0xc0128550
    if (did_init) {
c0101f7a:	a1 4c b7 12 c0       	mov    0xc012b74c,%eax
c0101f7f:	85 c0                	test   %eax,%eax
c0101f81:	74 39                	je     c0101fbc <pic_setmask+0x5c>
        outb(IO_PIC1 + 1, mask);
c0101f83:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0101f86:	0f b6 c0             	movzbl %al,%eax
c0101f89:	66 c7 45 fa 21 00    	movw   $0x21,-0x6(%ebp)
c0101f8f:	88 45 f9             	mov    %al,-0x7(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101f92:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0101f96:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c0101f9a:	ee                   	out    %al,(%dx)
}
c0101f9b:	90                   	nop
        outb(IO_PIC2 + 1, mask >> 8);
c0101f9c:	0f b7 45 ec          	movzwl -0x14(%ebp),%eax
c0101fa0:	c1 e8 08             	shr    $0x8,%eax
c0101fa3:	0f b7 c0             	movzwl %ax,%eax
c0101fa6:	0f b6 c0             	movzbl %al,%eax
c0101fa9:	66 c7 45 fe a1 00    	movw   $0xa1,-0x2(%ebp)
c0101faf:	88 45 fd             	mov    %al,-0x3(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0101fb2:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c0101fb6:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0101fba:	ee                   	out    %al,(%dx)
}
c0101fbb:	90                   	nop
    }
}
c0101fbc:	90                   	nop
c0101fbd:	c9                   	leave  
c0101fbe:	c3                   	ret    

c0101fbf <pic_enable>:

void
pic_enable(unsigned int irq) {
c0101fbf:	f3 0f 1e fb          	endbr32 
c0101fc3:	55                   	push   %ebp
c0101fc4:	89 e5                	mov    %esp,%ebp
c0101fc6:	83 ec 04             	sub    $0x4,%esp
    pic_setmask(irq_mask & ~(1 << irq));
c0101fc9:	8b 45 08             	mov    0x8(%ebp),%eax
c0101fcc:	ba 01 00 00 00       	mov    $0x1,%edx
c0101fd1:	88 c1                	mov    %al,%cl
c0101fd3:	d3 e2                	shl    %cl,%edx
c0101fd5:	89 d0                	mov    %edx,%eax
c0101fd7:	98                   	cwtl   
c0101fd8:	f7 d0                	not    %eax
c0101fda:	0f bf d0             	movswl %ax,%edx
c0101fdd:	0f b7 05 50 85 12 c0 	movzwl 0xc0128550,%eax
c0101fe4:	98                   	cwtl   
c0101fe5:	21 d0                	and    %edx,%eax
c0101fe7:	98                   	cwtl   
c0101fe8:	0f b7 c0             	movzwl %ax,%eax
c0101feb:	89 04 24             	mov    %eax,(%esp)
c0101fee:	e8 6d ff ff ff       	call   c0101f60 <pic_setmask>
}
c0101ff3:	90                   	nop
c0101ff4:	c9                   	leave  
c0101ff5:	c3                   	ret    

c0101ff6 <pic_init>:

/* pic_init - initialize the 8259A interrupt controllers */
void
pic_init(void) {
c0101ff6:	f3 0f 1e fb          	endbr32 
c0101ffa:	55                   	push   %ebp
c0101ffb:	89 e5                	mov    %esp,%ebp
c0101ffd:	83 ec 44             	sub    $0x44,%esp
    did_init = 1;
c0102000:	c7 05 4c b7 12 c0 01 	movl   $0x1,0xc012b74c
c0102007:	00 00 00 
c010200a:	66 c7 45 ca 21 00    	movw   $0x21,-0x36(%ebp)
c0102010:	c6 45 c9 ff          	movb   $0xff,-0x37(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102014:	0f b6 45 c9          	movzbl -0x37(%ebp),%eax
c0102018:	0f b7 55 ca          	movzwl -0x36(%ebp),%edx
c010201c:	ee                   	out    %al,(%dx)
}
c010201d:	90                   	nop
c010201e:	66 c7 45 ce a1 00    	movw   $0xa1,-0x32(%ebp)
c0102024:	c6 45 cd ff          	movb   $0xff,-0x33(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102028:	0f b6 45 cd          	movzbl -0x33(%ebp),%eax
c010202c:	0f b7 55 ce          	movzwl -0x32(%ebp),%edx
c0102030:	ee                   	out    %al,(%dx)
}
c0102031:	90                   	nop
c0102032:	66 c7 45 d2 20 00    	movw   $0x20,-0x2e(%ebp)
c0102038:	c6 45 d1 11          	movb   $0x11,-0x2f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010203c:	0f b6 45 d1          	movzbl -0x2f(%ebp),%eax
c0102040:	0f b7 55 d2          	movzwl -0x2e(%ebp),%edx
c0102044:	ee                   	out    %al,(%dx)
}
c0102045:	90                   	nop
c0102046:	66 c7 45 d6 21 00    	movw   $0x21,-0x2a(%ebp)
c010204c:	c6 45 d5 20          	movb   $0x20,-0x2b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102050:	0f b6 45 d5          	movzbl -0x2b(%ebp),%eax
c0102054:	0f b7 55 d6          	movzwl -0x2a(%ebp),%edx
c0102058:	ee                   	out    %al,(%dx)
}
c0102059:	90                   	nop
c010205a:	66 c7 45 da 21 00    	movw   $0x21,-0x26(%ebp)
c0102060:	c6 45 d9 04          	movb   $0x4,-0x27(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102064:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
c0102068:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
c010206c:	ee                   	out    %al,(%dx)
}
c010206d:	90                   	nop
c010206e:	66 c7 45 de 21 00    	movw   $0x21,-0x22(%ebp)
c0102074:	c6 45 dd 03          	movb   $0x3,-0x23(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102078:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
c010207c:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
c0102080:	ee                   	out    %al,(%dx)
}
c0102081:	90                   	nop
c0102082:	66 c7 45 e2 a0 00    	movw   $0xa0,-0x1e(%ebp)
c0102088:	c6 45 e1 11          	movb   $0x11,-0x1f(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c010208c:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
c0102090:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
c0102094:	ee                   	out    %al,(%dx)
}
c0102095:	90                   	nop
c0102096:	66 c7 45 e6 a1 00    	movw   $0xa1,-0x1a(%ebp)
c010209c:	c6 45 e5 28          	movb   $0x28,-0x1b(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01020a0:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
c01020a4:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
c01020a8:	ee                   	out    %al,(%dx)
}
c01020a9:	90                   	nop
c01020aa:	66 c7 45 ea a1 00    	movw   $0xa1,-0x16(%ebp)
c01020b0:	c6 45 e9 02          	movb   $0x2,-0x17(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01020b4:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
c01020b8:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
c01020bc:	ee                   	out    %al,(%dx)
}
c01020bd:	90                   	nop
c01020be:	66 c7 45 ee a1 00    	movw   $0xa1,-0x12(%ebp)
c01020c4:	c6 45 ed 03          	movb   $0x3,-0x13(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01020c8:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
c01020cc:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
c01020d0:	ee                   	out    %al,(%dx)
}
c01020d1:	90                   	nop
c01020d2:	66 c7 45 f2 20 00    	movw   $0x20,-0xe(%ebp)
c01020d8:	c6 45 f1 68          	movb   $0x68,-0xf(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01020dc:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
c01020e0:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
c01020e4:	ee                   	out    %al,(%dx)
}
c01020e5:	90                   	nop
c01020e6:	66 c7 45 f6 20 00    	movw   $0x20,-0xa(%ebp)
c01020ec:	c6 45 f5 0a          	movb   $0xa,-0xb(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c01020f0:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
c01020f4:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
c01020f8:	ee                   	out    %al,(%dx)
}
c01020f9:	90                   	nop
c01020fa:	66 c7 45 fa a0 00    	movw   $0xa0,-0x6(%ebp)
c0102100:	c6 45 f9 68          	movb   $0x68,-0x7(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102104:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
c0102108:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
c010210c:	ee                   	out    %al,(%dx)
}
c010210d:	90                   	nop
c010210e:	66 c7 45 fe a0 00    	movw   $0xa0,-0x2(%ebp)
c0102114:	c6 45 fd 0a          	movb   $0xa,-0x3(%ebp)
    asm volatile ("outb %0, %1" :: "a" (data), "d" (port) : "memory");
c0102118:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
c010211c:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
c0102120:	ee                   	out    %al,(%dx)
}
c0102121:	90                   	nop
    outb(IO_PIC1, 0x0a);    // read IRR by default

    outb(IO_PIC2, 0x68);    // OCW3
    outb(IO_PIC2, 0x0a);    // OCW3

    if (irq_mask != 0xFFFF) {
c0102122:	0f b7 05 50 85 12 c0 	movzwl 0xc0128550,%eax
c0102129:	3d ff ff 00 00       	cmp    $0xffff,%eax
c010212e:	74 0f                	je     c010213f <pic_init+0x149>
        pic_setmask(irq_mask);
c0102130:	0f b7 05 50 85 12 c0 	movzwl 0xc0128550,%eax
c0102137:	89 04 24             	mov    %eax,(%esp)
c010213a:	e8 21 fe ff ff       	call   c0101f60 <pic_setmask>
    }
}
c010213f:	90                   	nop
c0102140:	c9                   	leave  
c0102141:	c3                   	ret    

c0102142 <intr_enable>:
#include <x86.h>
#include <intr.h>

/* intr_enable - enable irq interrupt */
void
intr_enable(void) {
c0102142:	f3 0f 1e fb          	endbr32 
c0102146:	55                   	push   %ebp
c0102147:	89 e5                	mov    %esp,%ebp
    asm volatile ("sti");
c0102149:	fb                   	sti    
}
c010214a:	90                   	nop
    sti();
}
c010214b:	90                   	nop
c010214c:	5d                   	pop    %ebp
c010214d:	c3                   	ret    

c010214e <intr_disable>:

/* intr_disable - disable irq interrupt */
void
intr_disable(void) {
c010214e:	f3 0f 1e fb          	endbr32 
c0102152:	55                   	push   %ebp
c0102153:	89 e5                	mov    %esp,%ebp
    asm volatile ("cli" ::: "memory");
c0102155:	fa                   	cli    
}
c0102156:	90                   	nop
    cli();
}
c0102157:	90                   	nop
c0102158:	5d                   	pop    %ebp
c0102159:	c3                   	ret    

c010215a <print_ticks>:
#include <swap.h>
#include <kdebug.h>

#define TICK_NUM 100

static void print_ticks() {
c010215a:	f3 0f 1e fb          	endbr32 
c010215e:	55                   	push   %ebp
c010215f:	89 e5                	mov    %esp,%ebp
c0102161:	83 ec 18             	sub    $0x18,%esp
    cprintf("%d ticks\n",TICK_NUM);
c0102164:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c010216b:	00 
c010216c:	c7 04 24 c0 a4 10 c0 	movl   $0xc010a4c0,(%esp)
c0102173:	e8 59 e1 ff ff       	call   c01002d1 <cprintf>
#ifdef DEBUG_GRADE
    cprintf("End of Test.\n");
c0102178:	c7 04 24 ca a4 10 c0 	movl   $0xc010a4ca,(%esp)
c010217f:	e8 4d e1 ff ff       	call   c01002d1 <cprintf>
    panic("EOT: kernel seems ok.");
c0102184:	c7 44 24 08 d8 a4 10 	movl   $0xc010a4d8,0x8(%esp)
c010218b:	c0 
c010218c:	c7 44 24 04 14 00 00 	movl   $0x14,0x4(%esp)
c0102193:	00 
c0102194:	c7 04 24 ee a4 10 c0 	movl   $0xc010a4ee,(%esp)
c010219b:	e8 9d e2 ff ff       	call   c010043d <__panic>

c01021a0 <idt_init>:
    sizeof(idt) - 1, (uintptr_t)idt
};

/* idt_init - initialize IDT to each of the entry points in kern/trap/vectors.S */
void
idt_init(void) {
c01021a0:	f3 0f 1e fb          	endbr32 
c01021a4:	55                   	push   %ebp
c01021a5:	89 e5                	mov    %esp,%ebp
c01021a7:	83 ec 10             	sub    $0x10,%esp
      *     You don't know the meaning of this instruction? just google it! and check the libs/x86.h to know more.
      *     Notice: the argument of lidt is idt_pd. try to find it!
      */
    extern uintptr_t __vectors[];
    int i;
    for (i = 0; i < sizeof(idt) / sizeof(struct gatedesc); i ++) {
c01021aa:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
c01021b1:	e9 c4 00 00 00       	jmp    c010227a <idt_init+0xda>
        SETGATE(idt[i], 0, GD_KTEXT, __vectors[i], DPL_KERNEL);
c01021b6:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021b9:	8b 04 85 e0 85 12 c0 	mov    -0x3fed7a20(,%eax,4),%eax
c01021c0:	0f b7 d0             	movzwl %ax,%edx
c01021c3:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021c6:	66 89 14 c5 60 b7 12 	mov    %dx,-0x3fed48a0(,%eax,8)
c01021cd:	c0 
c01021ce:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021d1:	66 c7 04 c5 62 b7 12 	movw   $0x8,-0x3fed489e(,%eax,8)
c01021d8:	c0 08 00 
c01021db:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021de:	0f b6 14 c5 64 b7 12 	movzbl -0x3fed489c(,%eax,8),%edx
c01021e5:	c0 
c01021e6:	80 e2 e0             	and    $0xe0,%dl
c01021e9:	88 14 c5 64 b7 12 c0 	mov    %dl,-0x3fed489c(,%eax,8)
c01021f0:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01021f3:	0f b6 14 c5 64 b7 12 	movzbl -0x3fed489c(,%eax,8),%edx
c01021fa:	c0 
c01021fb:	80 e2 1f             	and    $0x1f,%dl
c01021fe:	88 14 c5 64 b7 12 c0 	mov    %dl,-0x3fed489c(,%eax,8)
c0102205:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102208:	0f b6 14 c5 65 b7 12 	movzbl -0x3fed489b(,%eax,8),%edx
c010220f:	c0 
c0102210:	80 e2 f0             	and    $0xf0,%dl
c0102213:	80 ca 0e             	or     $0xe,%dl
c0102216:	88 14 c5 65 b7 12 c0 	mov    %dl,-0x3fed489b(,%eax,8)
c010221d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102220:	0f b6 14 c5 65 b7 12 	movzbl -0x3fed489b(,%eax,8),%edx
c0102227:	c0 
c0102228:	80 e2 ef             	and    $0xef,%dl
c010222b:	88 14 c5 65 b7 12 c0 	mov    %dl,-0x3fed489b(,%eax,8)
c0102232:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0102235:	0f b6 14 c5 65 b7 12 	movzbl -0x3fed489b(,%eax,8),%edx
c010223c:	c0 
c010223d:	80 e2 9f             	and    $0x9f,%dl
c0102240:	88 14 c5 65 b7 12 c0 	mov    %dl,-0x3fed489b(,%eax,8)
c0102247:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010224a:	0f b6 14 c5 65 b7 12 	movzbl -0x3fed489b(,%eax,8),%edx
c0102251:	c0 
c0102252:	80 ca 80             	or     $0x80,%dl
c0102255:	88 14 c5 65 b7 12 c0 	mov    %dl,-0x3fed489b(,%eax,8)
c010225c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010225f:	8b 04 85 e0 85 12 c0 	mov    -0x3fed7a20(,%eax,4),%eax
c0102266:	c1 e8 10             	shr    $0x10,%eax
c0102269:	0f b7 d0             	movzwl %ax,%edx
c010226c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010226f:	66 89 14 c5 66 b7 12 	mov    %dx,-0x3fed489a(,%eax,8)
c0102276:	c0 
    for (i = 0; i < sizeof(idt) / sizeof(struct gatedesc); i ++) {
c0102277:	ff 45 fc             	incl   -0x4(%ebp)
c010227a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010227d:	3d ff 00 00 00       	cmp    $0xff,%eax
c0102282:	0f 86 2e ff ff ff    	jbe    c01021b6 <idt_init+0x16>
c0102288:	c7 45 f8 60 85 12 c0 	movl   $0xc0128560,-0x8(%ebp)
    asm volatile ("lidt (%0)" :: "r" (pd) : "memory");
c010228f:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0102292:	0f 01 18             	lidtl  (%eax)
}
c0102295:	90                   	nop
    }
    lidt(&idt_pd);
}
c0102296:	90                   	nop
c0102297:	c9                   	leave  
c0102298:	c3                   	ret    

c0102299 <trapname>:

static const char *
trapname(int trapno) {
c0102299:	f3 0f 1e fb          	endbr32 
c010229d:	55                   	push   %ebp
c010229e:	89 e5                	mov    %esp,%ebp
        "Alignment Check",
        "Machine-Check",
        "SIMD Floating-Point Exception"
    };

    if (trapno < sizeof(excnames)/sizeof(const char * const)) {
c01022a0:	8b 45 08             	mov    0x8(%ebp),%eax
c01022a3:	83 f8 13             	cmp    $0x13,%eax
c01022a6:	77 0c                	ja     c01022b4 <trapname+0x1b>
        return excnames[trapno];
c01022a8:	8b 45 08             	mov    0x8(%ebp),%eax
c01022ab:	8b 04 85 40 a9 10 c0 	mov    -0x3fef56c0(,%eax,4),%eax
c01022b2:	eb 18                	jmp    c01022cc <trapname+0x33>
    }
    if (trapno >= IRQ_OFFSET && trapno < IRQ_OFFSET + 16) {
c01022b4:	83 7d 08 1f          	cmpl   $0x1f,0x8(%ebp)
c01022b8:	7e 0d                	jle    c01022c7 <trapname+0x2e>
c01022ba:	83 7d 08 2f          	cmpl   $0x2f,0x8(%ebp)
c01022be:	7f 07                	jg     c01022c7 <trapname+0x2e>
        return "Hardware Interrupt";
c01022c0:	b8 ff a4 10 c0       	mov    $0xc010a4ff,%eax
c01022c5:	eb 05                	jmp    c01022cc <trapname+0x33>
    }
    return "(unknown trap)";
c01022c7:	b8 12 a5 10 c0       	mov    $0xc010a512,%eax
}
c01022cc:	5d                   	pop    %ebp
c01022cd:	c3                   	ret    

c01022ce <trap_in_kernel>:

/* trap_in_kernel - test if trap happened in kernel */
bool
trap_in_kernel(struct trapframe *tf) {
c01022ce:	f3 0f 1e fb          	endbr32 
c01022d2:	55                   	push   %ebp
c01022d3:	89 e5                	mov    %esp,%ebp
    return (tf->tf_cs == (uint16_t)KERNEL_CS);
c01022d5:	8b 45 08             	mov    0x8(%ebp),%eax
c01022d8:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c01022dc:	83 f8 08             	cmp    $0x8,%eax
c01022df:	0f 94 c0             	sete   %al
c01022e2:	0f b6 c0             	movzbl %al,%eax
}
c01022e5:	5d                   	pop    %ebp
c01022e6:	c3                   	ret    

c01022e7 <print_trapframe>:
    "TF", "IF", "DF", "OF", NULL, NULL, "NT", NULL,
    "RF", "VM", "AC", "VIF", "VIP", "ID", NULL, NULL,
};

void
print_trapframe(struct trapframe *tf) {
c01022e7:	f3 0f 1e fb          	endbr32 
c01022eb:	55                   	push   %ebp
c01022ec:	89 e5                	mov    %esp,%ebp
c01022ee:	83 ec 28             	sub    $0x28,%esp
    cprintf("trapframe at %p\n", tf);
c01022f1:	8b 45 08             	mov    0x8(%ebp),%eax
c01022f4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01022f8:	c7 04 24 53 a5 10 c0 	movl   $0xc010a553,(%esp)
c01022ff:	e8 cd df ff ff       	call   c01002d1 <cprintf>
    print_regs(&tf->tf_regs);
c0102304:	8b 45 08             	mov    0x8(%ebp),%eax
c0102307:	89 04 24             	mov    %eax,(%esp)
c010230a:	e8 8d 01 00 00       	call   c010249c <print_regs>
    cprintf("  ds   0x----%04x\n", tf->tf_ds);
c010230f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102312:	0f b7 40 2c          	movzwl 0x2c(%eax),%eax
c0102316:	89 44 24 04          	mov    %eax,0x4(%esp)
c010231a:	c7 04 24 64 a5 10 c0 	movl   $0xc010a564,(%esp)
c0102321:	e8 ab df ff ff       	call   c01002d1 <cprintf>
    cprintf("  es   0x----%04x\n", tf->tf_es);
c0102326:	8b 45 08             	mov    0x8(%ebp),%eax
c0102329:	0f b7 40 28          	movzwl 0x28(%eax),%eax
c010232d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102331:	c7 04 24 77 a5 10 c0 	movl   $0xc010a577,(%esp)
c0102338:	e8 94 df ff ff       	call   c01002d1 <cprintf>
    cprintf("  fs   0x----%04x\n", tf->tf_fs);
c010233d:	8b 45 08             	mov    0x8(%ebp),%eax
c0102340:	0f b7 40 24          	movzwl 0x24(%eax),%eax
c0102344:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102348:	c7 04 24 8a a5 10 c0 	movl   $0xc010a58a,(%esp)
c010234f:	e8 7d df ff ff       	call   c01002d1 <cprintf>
    cprintf("  gs   0x----%04x\n", tf->tf_gs);
c0102354:	8b 45 08             	mov    0x8(%ebp),%eax
c0102357:	0f b7 40 20          	movzwl 0x20(%eax),%eax
c010235b:	89 44 24 04          	mov    %eax,0x4(%esp)
c010235f:	c7 04 24 9d a5 10 c0 	movl   $0xc010a59d,(%esp)
c0102366:	e8 66 df ff ff       	call   c01002d1 <cprintf>
    cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
c010236b:	8b 45 08             	mov    0x8(%ebp),%eax
c010236e:	8b 40 30             	mov    0x30(%eax),%eax
c0102371:	89 04 24             	mov    %eax,(%esp)
c0102374:	e8 20 ff ff ff       	call   c0102299 <trapname>
c0102379:	8b 55 08             	mov    0x8(%ebp),%edx
c010237c:	8b 52 30             	mov    0x30(%edx),%edx
c010237f:	89 44 24 08          	mov    %eax,0x8(%esp)
c0102383:	89 54 24 04          	mov    %edx,0x4(%esp)
c0102387:	c7 04 24 b0 a5 10 c0 	movl   $0xc010a5b0,(%esp)
c010238e:	e8 3e df ff ff       	call   c01002d1 <cprintf>
    cprintf("  err  0x%08x\n", tf->tf_err);
c0102393:	8b 45 08             	mov    0x8(%ebp),%eax
c0102396:	8b 40 34             	mov    0x34(%eax),%eax
c0102399:	89 44 24 04          	mov    %eax,0x4(%esp)
c010239d:	c7 04 24 c2 a5 10 c0 	movl   $0xc010a5c2,(%esp)
c01023a4:	e8 28 df ff ff       	call   c01002d1 <cprintf>
    cprintf("  eip  0x%08x\n", tf->tf_eip);
c01023a9:	8b 45 08             	mov    0x8(%ebp),%eax
c01023ac:	8b 40 38             	mov    0x38(%eax),%eax
c01023af:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023b3:	c7 04 24 d1 a5 10 c0 	movl   $0xc010a5d1,(%esp)
c01023ba:	e8 12 df ff ff       	call   c01002d1 <cprintf>
    cprintf("  cs   0x----%04x\n", tf->tf_cs);
c01023bf:	8b 45 08             	mov    0x8(%ebp),%eax
c01023c2:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c01023c6:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023ca:	c7 04 24 e0 a5 10 c0 	movl   $0xc010a5e0,(%esp)
c01023d1:	e8 fb de ff ff       	call   c01002d1 <cprintf>
    cprintf("  flag 0x%08x ", tf->tf_eflags);
c01023d6:	8b 45 08             	mov    0x8(%ebp),%eax
c01023d9:	8b 40 40             	mov    0x40(%eax),%eax
c01023dc:	89 44 24 04          	mov    %eax,0x4(%esp)
c01023e0:	c7 04 24 f3 a5 10 c0 	movl   $0xc010a5f3,(%esp)
c01023e7:	e8 e5 de ff ff       	call   c01002d1 <cprintf>

    int i, j;
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c01023ec:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01023f3:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
c01023fa:	eb 3d                	jmp    c0102439 <print_trapframe+0x152>
        if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
c01023fc:	8b 45 08             	mov    0x8(%ebp),%eax
c01023ff:	8b 50 40             	mov    0x40(%eax),%edx
c0102402:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0102405:	21 d0                	and    %edx,%eax
c0102407:	85 c0                	test   %eax,%eax
c0102409:	74 28                	je     c0102433 <print_trapframe+0x14c>
c010240b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010240e:	8b 04 85 80 85 12 c0 	mov    -0x3fed7a80(,%eax,4),%eax
c0102415:	85 c0                	test   %eax,%eax
c0102417:	74 1a                	je     c0102433 <print_trapframe+0x14c>
            cprintf("%s,", IA32flags[i]);
c0102419:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010241c:	8b 04 85 80 85 12 c0 	mov    -0x3fed7a80(,%eax,4),%eax
c0102423:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102427:	c7 04 24 02 a6 10 c0 	movl   $0xc010a602,(%esp)
c010242e:	e8 9e de ff ff       	call   c01002d1 <cprintf>
    for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
c0102433:	ff 45 f4             	incl   -0xc(%ebp)
c0102436:	d1 65 f0             	shll   -0x10(%ebp)
c0102439:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010243c:	83 f8 17             	cmp    $0x17,%eax
c010243f:	76 bb                	jbe    c01023fc <print_trapframe+0x115>
        }
    }
    cprintf("IOPL=%d\n", (tf->tf_eflags & FL_IOPL_MASK) >> 12);
c0102441:	8b 45 08             	mov    0x8(%ebp),%eax
c0102444:	8b 40 40             	mov    0x40(%eax),%eax
c0102447:	c1 e8 0c             	shr    $0xc,%eax
c010244a:	83 e0 03             	and    $0x3,%eax
c010244d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102451:	c7 04 24 06 a6 10 c0 	movl   $0xc010a606,(%esp)
c0102458:	e8 74 de ff ff       	call   c01002d1 <cprintf>

    if (!trap_in_kernel(tf)) {
c010245d:	8b 45 08             	mov    0x8(%ebp),%eax
c0102460:	89 04 24             	mov    %eax,(%esp)
c0102463:	e8 66 fe ff ff       	call   c01022ce <trap_in_kernel>
c0102468:	85 c0                	test   %eax,%eax
c010246a:	75 2d                	jne    c0102499 <print_trapframe+0x1b2>
        cprintf("  esp  0x%08x\n", tf->tf_esp);
c010246c:	8b 45 08             	mov    0x8(%ebp),%eax
c010246f:	8b 40 44             	mov    0x44(%eax),%eax
c0102472:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102476:	c7 04 24 0f a6 10 c0 	movl   $0xc010a60f,(%esp)
c010247d:	e8 4f de ff ff       	call   c01002d1 <cprintf>
        cprintf("  ss   0x----%04x\n", tf->tf_ss);
c0102482:	8b 45 08             	mov    0x8(%ebp),%eax
c0102485:	0f b7 40 48          	movzwl 0x48(%eax),%eax
c0102489:	89 44 24 04          	mov    %eax,0x4(%esp)
c010248d:	c7 04 24 1e a6 10 c0 	movl   $0xc010a61e,(%esp)
c0102494:	e8 38 de ff ff       	call   c01002d1 <cprintf>
    }
}
c0102499:	90                   	nop
c010249a:	c9                   	leave  
c010249b:	c3                   	ret    

c010249c <print_regs>:

void
print_regs(struct pushregs *regs) {
c010249c:	f3 0f 1e fb          	endbr32 
c01024a0:	55                   	push   %ebp
c01024a1:	89 e5                	mov    %esp,%ebp
c01024a3:	83 ec 18             	sub    $0x18,%esp
    cprintf("  edi  0x%08x\n", regs->reg_edi);
c01024a6:	8b 45 08             	mov    0x8(%ebp),%eax
c01024a9:	8b 00                	mov    (%eax),%eax
c01024ab:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024af:	c7 04 24 31 a6 10 c0 	movl   $0xc010a631,(%esp)
c01024b6:	e8 16 de ff ff       	call   c01002d1 <cprintf>
    cprintf("  esi  0x%08x\n", regs->reg_esi);
c01024bb:	8b 45 08             	mov    0x8(%ebp),%eax
c01024be:	8b 40 04             	mov    0x4(%eax),%eax
c01024c1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024c5:	c7 04 24 40 a6 10 c0 	movl   $0xc010a640,(%esp)
c01024cc:	e8 00 de ff ff       	call   c01002d1 <cprintf>
    cprintf("  ebp  0x%08x\n", regs->reg_ebp);
c01024d1:	8b 45 08             	mov    0x8(%ebp),%eax
c01024d4:	8b 40 08             	mov    0x8(%eax),%eax
c01024d7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024db:	c7 04 24 4f a6 10 c0 	movl   $0xc010a64f,(%esp)
c01024e2:	e8 ea dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  oesp 0x%08x\n", regs->reg_oesp);
c01024e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01024ea:	8b 40 0c             	mov    0xc(%eax),%eax
c01024ed:	89 44 24 04          	mov    %eax,0x4(%esp)
c01024f1:	c7 04 24 5e a6 10 c0 	movl   $0xc010a65e,(%esp)
c01024f8:	e8 d4 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  ebx  0x%08x\n", regs->reg_ebx);
c01024fd:	8b 45 08             	mov    0x8(%ebp),%eax
c0102500:	8b 40 10             	mov    0x10(%eax),%eax
c0102503:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102507:	c7 04 24 6d a6 10 c0 	movl   $0xc010a66d,(%esp)
c010250e:	e8 be dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  edx  0x%08x\n", regs->reg_edx);
c0102513:	8b 45 08             	mov    0x8(%ebp),%eax
c0102516:	8b 40 14             	mov    0x14(%eax),%eax
c0102519:	89 44 24 04          	mov    %eax,0x4(%esp)
c010251d:	c7 04 24 7c a6 10 c0 	movl   $0xc010a67c,(%esp)
c0102524:	e8 a8 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  ecx  0x%08x\n", regs->reg_ecx);
c0102529:	8b 45 08             	mov    0x8(%ebp),%eax
c010252c:	8b 40 18             	mov    0x18(%eax),%eax
c010252f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102533:	c7 04 24 8b a6 10 c0 	movl   $0xc010a68b,(%esp)
c010253a:	e8 92 dd ff ff       	call   c01002d1 <cprintf>
    cprintf("  eax  0x%08x\n", regs->reg_eax);
c010253f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102542:	8b 40 1c             	mov    0x1c(%eax),%eax
c0102545:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102549:	c7 04 24 9a a6 10 c0 	movl   $0xc010a69a,(%esp)
c0102550:	e8 7c dd ff ff       	call   c01002d1 <cprintf>
}
c0102555:	90                   	nop
c0102556:	c9                   	leave  
c0102557:	c3                   	ret    

c0102558 <print_pgfault>:

static inline void
print_pgfault(struct trapframe *tf) {
c0102558:	55                   	push   %ebp
c0102559:	89 e5                	mov    %esp,%ebp
c010255b:	53                   	push   %ebx
c010255c:	83 ec 34             	sub    $0x34,%esp
     * bit 2 == 0 means kernel, 1 means user
     * */
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
            (tf->tf_err & 4) ? 'U' : 'K',
            (tf->tf_err & 2) ? 'W' : 'R',
            (tf->tf_err & 1) ? "protection fault" : "no page found");
c010255f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102562:	8b 40 34             	mov    0x34(%eax),%eax
c0102565:	83 e0 01             	and    $0x1,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0102568:	85 c0                	test   %eax,%eax
c010256a:	74 07                	je     c0102573 <print_pgfault+0x1b>
c010256c:	bb a9 a6 10 c0       	mov    $0xc010a6a9,%ebx
c0102571:	eb 05                	jmp    c0102578 <print_pgfault+0x20>
c0102573:	bb ba a6 10 c0       	mov    $0xc010a6ba,%ebx
            (tf->tf_err & 2) ? 'W' : 'R',
c0102578:	8b 45 08             	mov    0x8(%ebp),%eax
c010257b:	8b 40 34             	mov    0x34(%eax),%eax
c010257e:	83 e0 02             	and    $0x2,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c0102581:	85 c0                	test   %eax,%eax
c0102583:	74 07                	je     c010258c <print_pgfault+0x34>
c0102585:	b9 57 00 00 00       	mov    $0x57,%ecx
c010258a:	eb 05                	jmp    c0102591 <print_pgfault+0x39>
c010258c:	b9 52 00 00 00       	mov    $0x52,%ecx
            (tf->tf_err & 4) ? 'U' : 'K',
c0102591:	8b 45 08             	mov    0x8(%ebp),%eax
c0102594:	8b 40 34             	mov    0x34(%eax),%eax
c0102597:	83 e0 04             	and    $0x4,%eax
    cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
c010259a:	85 c0                	test   %eax,%eax
c010259c:	74 07                	je     c01025a5 <print_pgfault+0x4d>
c010259e:	ba 55 00 00 00       	mov    $0x55,%edx
c01025a3:	eb 05                	jmp    c01025aa <print_pgfault+0x52>
c01025a5:	ba 4b 00 00 00       	mov    $0x4b,%edx
}

static inline uintptr_t
rcr2(void) {
    uintptr_t cr2;
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c01025aa:	0f 20 d0             	mov    %cr2,%eax
c01025ad:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr2;
c01025b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01025b3:	89 5c 24 10          	mov    %ebx,0x10(%esp)
c01025b7:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c01025bb:	89 54 24 08          	mov    %edx,0x8(%esp)
c01025bf:	89 44 24 04          	mov    %eax,0x4(%esp)
c01025c3:	c7 04 24 c8 a6 10 c0 	movl   $0xc010a6c8,(%esp)
c01025ca:	e8 02 dd ff ff       	call   c01002d1 <cprintf>
}
c01025cf:	90                   	nop
c01025d0:	83 c4 34             	add    $0x34,%esp
c01025d3:	5b                   	pop    %ebx
c01025d4:	5d                   	pop    %ebp
c01025d5:	c3                   	ret    

c01025d6 <pgfault_handler>:

static int
pgfault_handler(struct trapframe *tf) {
c01025d6:	f3 0f 1e fb          	endbr32 
c01025da:	55                   	push   %ebp
c01025db:	89 e5                	mov    %esp,%ebp
c01025dd:	83 ec 28             	sub    $0x28,%esp
    extern struct mm_struct *check_mm_struct;
    print_pgfault(tf);
c01025e0:	8b 45 08             	mov    0x8(%ebp),%eax
c01025e3:	89 04 24             	mov    %eax,(%esp)
c01025e6:	e8 6d ff ff ff       	call   c0102558 <print_pgfault>
    if (check_mm_struct != NULL) {
c01025eb:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c01025f0:	85 c0                	test   %eax,%eax
c01025f2:	74 26                	je     c010261a <pgfault_handler+0x44>
    asm volatile ("mov %%cr2, %0" : "=r" (cr2) :: "memory");
c01025f4:	0f 20 d0             	mov    %cr2,%eax
c01025f7:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return cr2;
c01025fa:	8b 4d f4             	mov    -0xc(%ebp),%ecx
        return do_pgfault(check_mm_struct, tf->tf_err, rcr2());
c01025fd:	8b 45 08             	mov    0x8(%ebp),%eax
c0102600:	8b 50 34             	mov    0x34(%eax),%edx
c0102603:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c0102608:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c010260c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0102610:	89 04 24             	mov    %eax,(%esp)
c0102613:	e8 86 17 00 00       	call   c0103d9e <do_pgfault>
c0102618:	eb 1c                	jmp    c0102636 <pgfault_handler+0x60>
    }
    panic("unhandled page fault.\n");
c010261a:	c7 44 24 08 eb a6 10 	movl   $0xc010a6eb,0x8(%esp)
c0102621:	c0 
c0102622:	c7 44 24 04 a5 00 00 	movl   $0xa5,0x4(%esp)
c0102629:	00 
c010262a:	c7 04 24 ee a4 10 c0 	movl   $0xc010a4ee,(%esp)
c0102631:	e8 07 de ff ff       	call   c010043d <__panic>
}
c0102636:	c9                   	leave  
c0102637:	c3                   	ret    

c0102638 <trap_dispatch>:

static volatile int in_swap_tick_event = 0;
extern struct mm_struct *check_mm_struct;

static void
trap_dispatch(struct trapframe *tf) {
c0102638:	f3 0f 1e fb          	endbr32 
c010263c:	55                   	push   %ebp
c010263d:	89 e5                	mov    %esp,%ebp
c010263f:	83 ec 28             	sub    $0x28,%esp
    char c;

    int ret;

    switch (tf->tf_trapno) {
c0102642:	8b 45 08             	mov    0x8(%ebp),%eax
c0102645:	8b 40 30             	mov    0x30(%eax),%eax
c0102648:	83 f8 2f             	cmp    $0x2f,%eax
c010264b:	77 1f                	ja     c010266c <trap_dispatch+0x34>
c010264d:	83 f8 0e             	cmp    $0xe,%eax
c0102650:	0f 82 1b 01 00 00    	jb     c0102771 <trap_dispatch+0x139>
c0102656:	83 e8 0e             	sub    $0xe,%eax
c0102659:	83 f8 21             	cmp    $0x21,%eax
c010265c:	0f 87 0f 01 00 00    	ja     c0102771 <trap_dispatch+0x139>
c0102662:	8b 04 85 6c a7 10 c0 	mov    -0x3fef5894(,%eax,4),%eax
c0102669:	3e ff e0             	notrack jmp *%eax
c010266c:	83 e8 78             	sub    $0x78,%eax
c010266f:	83 f8 01             	cmp    $0x1,%eax
c0102672:	0f 87 f9 00 00 00    	ja     c0102771 <trap_dispatch+0x139>
c0102678:	e9 d8 00 00 00       	jmp    c0102755 <trap_dispatch+0x11d>
    case T_PGFLT:  //page fault
        if ((ret = pgfault_handler(tf)) != 0) {
c010267d:	8b 45 08             	mov    0x8(%ebp),%eax
c0102680:	89 04 24             	mov    %eax,(%esp)
c0102683:	e8 4e ff ff ff       	call   c01025d6 <pgfault_handler>
c0102688:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010268b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c010268f:	0f 84 14 01 00 00    	je     c01027a9 <trap_dispatch+0x171>
            print_trapframe(tf);
c0102695:	8b 45 08             	mov    0x8(%ebp),%eax
c0102698:	89 04 24             	mov    %eax,(%esp)
c010269b:	e8 47 fc ff ff       	call   c01022e7 <print_trapframe>
            panic("handle pgfault failed. %e\n", ret);
c01026a0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01026a3:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01026a7:	c7 44 24 08 02 a7 10 	movl   $0xc010a702,0x8(%esp)
c01026ae:	c0 
c01026af:	c7 44 24 04 b5 00 00 	movl   $0xb5,0x4(%esp)
c01026b6:	00 
c01026b7:	c7 04 24 ee a4 10 c0 	movl   $0xc010a4ee,(%esp)
c01026be:	e8 7a dd ff ff       	call   c010043d <__panic>
        /* handle the timer interrupt */
        /* (1) After a timer interrupt, you should record this event using a global variable (increase it), such as ticks in kern/driver/clock.c
         * (2) Every TICK_NUM cycle, you can print some info using a funciton, such as print_ticks().
         * (3) Too Simple? Yes, I think so!
         */
        ticks ++;
c01026c3:	a1 54 e0 12 c0       	mov    0xc012e054,%eax
c01026c8:	40                   	inc    %eax
c01026c9:	a3 54 e0 12 c0       	mov    %eax,0xc012e054
        if (ticks % TICK_NUM == 0) {
c01026ce:	8b 0d 54 e0 12 c0    	mov    0xc012e054,%ecx
c01026d4:	ba 1f 85 eb 51       	mov    $0x51eb851f,%edx
c01026d9:	89 c8                	mov    %ecx,%eax
c01026db:	f7 e2                	mul    %edx
c01026dd:	c1 ea 05             	shr    $0x5,%edx
c01026e0:	89 d0                	mov    %edx,%eax
c01026e2:	c1 e0 02             	shl    $0x2,%eax
c01026e5:	01 d0                	add    %edx,%eax
c01026e7:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01026ee:	01 d0                	add    %edx,%eax
c01026f0:	c1 e0 02             	shl    $0x2,%eax
c01026f3:	29 c1                	sub    %eax,%ecx
c01026f5:	89 ca                	mov    %ecx,%edx
c01026f7:	85 d2                	test   %edx,%edx
c01026f9:	0f 85 ad 00 00 00    	jne    c01027ac <trap_dispatch+0x174>
            print_ticks();
c01026ff:	e8 56 fa ff ff       	call   c010215a <print_ticks>
        }
        break;
c0102704:	e9 a3 00 00 00       	jmp    c01027ac <trap_dispatch+0x174>
    case IRQ_OFFSET + IRQ_COM1:
        c = cons_getc();
c0102709:	e8 df f7 ff ff       	call   c0101eed <cons_getc>
c010270e:	88 45 f7             	mov    %al,-0x9(%ebp)
        cprintf("serial [%03d] %c\n", c, c);
c0102711:	0f be 55 f7          	movsbl -0x9(%ebp),%edx
c0102715:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c0102719:	89 54 24 08          	mov    %edx,0x8(%esp)
c010271d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102721:	c7 04 24 1d a7 10 c0 	movl   $0xc010a71d,(%esp)
c0102728:	e8 a4 db ff ff       	call   c01002d1 <cprintf>
        break;
c010272d:	eb 7e                	jmp    c01027ad <trap_dispatch+0x175>
    case IRQ_OFFSET + IRQ_KBD:
        c = cons_getc();
c010272f:	e8 b9 f7 ff ff       	call   c0101eed <cons_getc>
c0102734:	88 45 f7             	mov    %al,-0x9(%ebp)
        cprintf("kbd [%03d] %c\n", c, c);
c0102737:	0f be 55 f7          	movsbl -0x9(%ebp),%edx
c010273b:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
c010273f:	89 54 24 08          	mov    %edx,0x8(%esp)
c0102743:	89 44 24 04          	mov    %eax,0x4(%esp)
c0102747:	c7 04 24 2f a7 10 c0 	movl   $0xc010a72f,(%esp)
c010274e:	e8 7e db ff ff       	call   c01002d1 <cprintf>
        break;
c0102753:	eb 58                	jmp    c01027ad <trap_dispatch+0x175>
    //LAB1 CHALLENGE 1 : YOUR CODE you should modify below codes.
    case T_SWITCH_TOU:
    case T_SWITCH_TOK:
        panic("T_SWITCH_** ??\n");
c0102755:	c7 44 24 08 3e a7 10 	movl   $0xc010a73e,0x8(%esp)
c010275c:	c0 
c010275d:	c7 44 24 04 d3 00 00 	movl   $0xd3,0x4(%esp)
c0102764:	00 
c0102765:	c7 04 24 ee a4 10 c0 	movl   $0xc010a4ee,(%esp)
c010276c:	e8 cc dc ff ff       	call   c010043d <__panic>
    case IRQ_OFFSET + IRQ_IDE2:
        /* do nothing */
        break;
    default:
        // in kernel, it must be a mistake
        if ((tf->tf_cs & 3) == 0) {
c0102771:	8b 45 08             	mov    0x8(%ebp),%eax
c0102774:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
c0102778:	83 e0 03             	and    $0x3,%eax
c010277b:	85 c0                	test   %eax,%eax
c010277d:	75 2e                	jne    c01027ad <trap_dispatch+0x175>
            print_trapframe(tf);
c010277f:	8b 45 08             	mov    0x8(%ebp),%eax
c0102782:	89 04 24             	mov    %eax,(%esp)
c0102785:	e8 5d fb ff ff       	call   c01022e7 <print_trapframe>
            panic("unexpected trap in kernel.\n");
c010278a:	c7 44 24 08 4e a7 10 	movl   $0xc010a74e,0x8(%esp)
c0102791:	c0 
c0102792:	c7 44 24 04 dd 00 00 	movl   $0xdd,0x4(%esp)
c0102799:	00 
c010279a:	c7 04 24 ee a4 10 c0 	movl   $0xc010a4ee,(%esp)
c01027a1:	e8 97 dc ff ff       	call   c010043d <__panic>
        break;
c01027a6:	90                   	nop
c01027a7:	eb 04                	jmp    c01027ad <trap_dispatch+0x175>
        break;
c01027a9:	90                   	nop
c01027aa:	eb 01                	jmp    c01027ad <trap_dispatch+0x175>
        break;
c01027ac:	90                   	nop
        }
    }
}
c01027ad:	90                   	nop
c01027ae:	c9                   	leave  
c01027af:	c3                   	ret    

c01027b0 <trap>:
 * trap - handles or dispatches an exception/interrupt. if and when trap() returns,
 * the code in kern/trap/trapentry.S restores the old CPU state saved in the
 * trapframe and then uses the iret instruction to return from the exception.
 * */
void
trap(struct trapframe *tf) {
c01027b0:	f3 0f 1e fb          	endbr32 
c01027b4:	55                   	push   %ebp
c01027b5:	89 e5                	mov    %esp,%ebp
c01027b7:	83 ec 18             	sub    $0x18,%esp
    // dispatch based on what type of trap occurred
    trap_dispatch(tf);
c01027ba:	8b 45 08             	mov    0x8(%ebp),%eax
c01027bd:	89 04 24             	mov    %eax,(%esp)
c01027c0:	e8 73 fe ff ff       	call   c0102638 <trap_dispatch>
}
c01027c5:	90                   	nop
c01027c6:	c9                   	leave  
c01027c7:	c3                   	ret    

c01027c8 <vector0>:
# handler
.text
.globl __alltraps
.globl vector0
vector0:
  pushl $0
c01027c8:	6a 00                	push   $0x0
  pushl $0
c01027ca:	6a 00                	push   $0x0
  jmp __alltraps
c01027cc:	e9 69 0a 00 00       	jmp    c010323a <__alltraps>

c01027d1 <vector1>:
.globl vector1
vector1:
  pushl $0
c01027d1:	6a 00                	push   $0x0
  pushl $1
c01027d3:	6a 01                	push   $0x1
  jmp __alltraps
c01027d5:	e9 60 0a 00 00       	jmp    c010323a <__alltraps>

c01027da <vector2>:
.globl vector2
vector2:
  pushl $0
c01027da:	6a 00                	push   $0x0
  pushl $2
c01027dc:	6a 02                	push   $0x2
  jmp __alltraps
c01027de:	e9 57 0a 00 00       	jmp    c010323a <__alltraps>

c01027e3 <vector3>:
.globl vector3
vector3:
  pushl $0
c01027e3:	6a 00                	push   $0x0
  pushl $3
c01027e5:	6a 03                	push   $0x3
  jmp __alltraps
c01027e7:	e9 4e 0a 00 00       	jmp    c010323a <__alltraps>

c01027ec <vector4>:
.globl vector4
vector4:
  pushl $0
c01027ec:	6a 00                	push   $0x0
  pushl $4
c01027ee:	6a 04                	push   $0x4
  jmp __alltraps
c01027f0:	e9 45 0a 00 00       	jmp    c010323a <__alltraps>

c01027f5 <vector5>:
.globl vector5
vector5:
  pushl $0
c01027f5:	6a 00                	push   $0x0
  pushl $5
c01027f7:	6a 05                	push   $0x5
  jmp __alltraps
c01027f9:	e9 3c 0a 00 00       	jmp    c010323a <__alltraps>

c01027fe <vector6>:
.globl vector6
vector6:
  pushl $0
c01027fe:	6a 00                	push   $0x0
  pushl $6
c0102800:	6a 06                	push   $0x6
  jmp __alltraps
c0102802:	e9 33 0a 00 00       	jmp    c010323a <__alltraps>

c0102807 <vector7>:
.globl vector7
vector7:
  pushl $0
c0102807:	6a 00                	push   $0x0
  pushl $7
c0102809:	6a 07                	push   $0x7
  jmp __alltraps
c010280b:	e9 2a 0a 00 00       	jmp    c010323a <__alltraps>

c0102810 <vector8>:
.globl vector8
vector8:
  pushl $8
c0102810:	6a 08                	push   $0x8
  jmp __alltraps
c0102812:	e9 23 0a 00 00       	jmp    c010323a <__alltraps>

c0102817 <vector9>:
.globl vector9
vector9:
  pushl $0
c0102817:	6a 00                	push   $0x0
  pushl $9
c0102819:	6a 09                	push   $0x9
  jmp __alltraps
c010281b:	e9 1a 0a 00 00       	jmp    c010323a <__alltraps>

c0102820 <vector10>:
.globl vector10
vector10:
  pushl $10
c0102820:	6a 0a                	push   $0xa
  jmp __alltraps
c0102822:	e9 13 0a 00 00       	jmp    c010323a <__alltraps>

c0102827 <vector11>:
.globl vector11
vector11:
  pushl $11
c0102827:	6a 0b                	push   $0xb
  jmp __alltraps
c0102829:	e9 0c 0a 00 00       	jmp    c010323a <__alltraps>

c010282e <vector12>:
.globl vector12
vector12:
  pushl $12
c010282e:	6a 0c                	push   $0xc
  jmp __alltraps
c0102830:	e9 05 0a 00 00       	jmp    c010323a <__alltraps>

c0102835 <vector13>:
.globl vector13
vector13:
  pushl $13
c0102835:	6a 0d                	push   $0xd
  jmp __alltraps
c0102837:	e9 fe 09 00 00       	jmp    c010323a <__alltraps>

c010283c <vector14>:
.globl vector14
vector14:
  pushl $14
c010283c:	6a 0e                	push   $0xe
  jmp __alltraps
c010283e:	e9 f7 09 00 00       	jmp    c010323a <__alltraps>

c0102843 <vector15>:
.globl vector15
vector15:
  pushl $0
c0102843:	6a 00                	push   $0x0
  pushl $15
c0102845:	6a 0f                	push   $0xf
  jmp __alltraps
c0102847:	e9 ee 09 00 00       	jmp    c010323a <__alltraps>

c010284c <vector16>:
.globl vector16
vector16:
  pushl $0
c010284c:	6a 00                	push   $0x0
  pushl $16
c010284e:	6a 10                	push   $0x10
  jmp __alltraps
c0102850:	e9 e5 09 00 00       	jmp    c010323a <__alltraps>

c0102855 <vector17>:
.globl vector17
vector17:
  pushl $17
c0102855:	6a 11                	push   $0x11
  jmp __alltraps
c0102857:	e9 de 09 00 00       	jmp    c010323a <__alltraps>

c010285c <vector18>:
.globl vector18
vector18:
  pushl $0
c010285c:	6a 00                	push   $0x0
  pushl $18
c010285e:	6a 12                	push   $0x12
  jmp __alltraps
c0102860:	e9 d5 09 00 00       	jmp    c010323a <__alltraps>

c0102865 <vector19>:
.globl vector19
vector19:
  pushl $0
c0102865:	6a 00                	push   $0x0
  pushl $19
c0102867:	6a 13                	push   $0x13
  jmp __alltraps
c0102869:	e9 cc 09 00 00       	jmp    c010323a <__alltraps>

c010286e <vector20>:
.globl vector20
vector20:
  pushl $0
c010286e:	6a 00                	push   $0x0
  pushl $20
c0102870:	6a 14                	push   $0x14
  jmp __alltraps
c0102872:	e9 c3 09 00 00       	jmp    c010323a <__alltraps>

c0102877 <vector21>:
.globl vector21
vector21:
  pushl $0
c0102877:	6a 00                	push   $0x0
  pushl $21
c0102879:	6a 15                	push   $0x15
  jmp __alltraps
c010287b:	e9 ba 09 00 00       	jmp    c010323a <__alltraps>

c0102880 <vector22>:
.globl vector22
vector22:
  pushl $0
c0102880:	6a 00                	push   $0x0
  pushl $22
c0102882:	6a 16                	push   $0x16
  jmp __alltraps
c0102884:	e9 b1 09 00 00       	jmp    c010323a <__alltraps>

c0102889 <vector23>:
.globl vector23
vector23:
  pushl $0
c0102889:	6a 00                	push   $0x0
  pushl $23
c010288b:	6a 17                	push   $0x17
  jmp __alltraps
c010288d:	e9 a8 09 00 00       	jmp    c010323a <__alltraps>

c0102892 <vector24>:
.globl vector24
vector24:
  pushl $0
c0102892:	6a 00                	push   $0x0
  pushl $24
c0102894:	6a 18                	push   $0x18
  jmp __alltraps
c0102896:	e9 9f 09 00 00       	jmp    c010323a <__alltraps>

c010289b <vector25>:
.globl vector25
vector25:
  pushl $0
c010289b:	6a 00                	push   $0x0
  pushl $25
c010289d:	6a 19                	push   $0x19
  jmp __alltraps
c010289f:	e9 96 09 00 00       	jmp    c010323a <__alltraps>

c01028a4 <vector26>:
.globl vector26
vector26:
  pushl $0
c01028a4:	6a 00                	push   $0x0
  pushl $26
c01028a6:	6a 1a                	push   $0x1a
  jmp __alltraps
c01028a8:	e9 8d 09 00 00       	jmp    c010323a <__alltraps>

c01028ad <vector27>:
.globl vector27
vector27:
  pushl $0
c01028ad:	6a 00                	push   $0x0
  pushl $27
c01028af:	6a 1b                	push   $0x1b
  jmp __alltraps
c01028b1:	e9 84 09 00 00       	jmp    c010323a <__alltraps>

c01028b6 <vector28>:
.globl vector28
vector28:
  pushl $0
c01028b6:	6a 00                	push   $0x0
  pushl $28
c01028b8:	6a 1c                	push   $0x1c
  jmp __alltraps
c01028ba:	e9 7b 09 00 00       	jmp    c010323a <__alltraps>

c01028bf <vector29>:
.globl vector29
vector29:
  pushl $0
c01028bf:	6a 00                	push   $0x0
  pushl $29
c01028c1:	6a 1d                	push   $0x1d
  jmp __alltraps
c01028c3:	e9 72 09 00 00       	jmp    c010323a <__alltraps>

c01028c8 <vector30>:
.globl vector30
vector30:
  pushl $0
c01028c8:	6a 00                	push   $0x0
  pushl $30
c01028ca:	6a 1e                	push   $0x1e
  jmp __alltraps
c01028cc:	e9 69 09 00 00       	jmp    c010323a <__alltraps>

c01028d1 <vector31>:
.globl vector31
vector31:
  pushl $0
c01028d1:	6a 00                	push   $0x0
  pushl $31
c01028d3:	6a 1f                	push   $0x1f
  jmp __alltraps
c01028d5:	e9 60 09 00 00       	jmp    c010323a <__alltraps>

c01028da <vector32>:
.globl vector32
vector32:
  pushl $0
c01028da:	6a 00                	push   $0x0
  pushl $32
c01028dc:	6a 20                	push   $0x20
  jmp __alltraps
c01028de:	e9 57 09 00 00       	jmp    c010323a <__alltraps>

c01028e3 <vector33>:
.globl vector33
vector33:
  pushl $0
c01028e3:	6a 00                	push   $0x0
  pushl $33
c01028e5:	6a 21                	push   $0x21
  jmp __alltraps
c01028e7:	e9 4e 09 00 00       	jmp    c010323a <__alltraps>

c01028ec <vector34>:
.globl vector34
vector34:
  pushl $0
c01028ec:	6a 00                	push   $0x0
  pushl $34
c01028ee:	6a 22                	push   $0x22
  jmp __alltraps
c01028f0:	e9 45 09 00 00       	jmp    c010323a <__alltraps>

c01028f5 <vector35>:
.globl vector35
vector35:
  pushl $0
c01028f5:	6a 00                	push   $0x0
  pushl $35
c01028f7:	6a 23                	push   $0x23
  jmp __alltraps
c01028f9:	e9 3c 09 00 00       	jmp    c010323a <__alltraps>

c01028fe <vector36>:
.globl vector36
vector36:
  pushl $0
c01028fe:	6a 00                	push   $0x0
  pushl $36
c0102900:	6a 24                	push   $0x24
  jmp __alltraps
c0102902:	e9 33 09 00 00       	jmp    c010323a <__alltraps>

c0102907 <vector37>:
.globl vector37
vector37:
  pushl $0
c0102907:	6a 00                	push   $0x0
  pushl $37
c0102909:	6a 25                	push   $0x25
  jmp __alltraps
c010290b:	e9 2a 09 00 00       	jmp    c010323a <__alltraps>

c0102910 <vector38>:
.globl vector38
vector38:
  pushl $0
c0102910:	6a 00                	push   $0x0
  pushl $38
c0102912:	6a 26                	push   $0x26
  jmp __alltraps
c0102914:	e9 21 09 00 00       	jmp    c010323a <__alltraps>

c0102919 <vector39>:
.globl vector39
vector39:
  pushl $0
c0102919:	6a 00                	push   $0x0
  pushl $39
c010291b:	6a 27                	push   $0x27
  jmp __alltraps
c010291d:	e9 18 09 00 00       	jmp    c010323a <__alltraps>

c0102922 <vector40>:
.globl vector40
vector40:
  pushl $0
c0102922:	6a 00                	push   $0x0
  pushl $40
c0102924:	6a 28                	push   $0x28
  jmp __alltraps
c0102926:	e9 0f 09 00 00       	jmp    c010323a <__alltraps>

c010292b <vector41>:
.globl vector41
vector41:
  pushl $0
c010292b:	6a 00                	push   $0x0
  pushl $41
c010292d:	6a 29                	push   $0x29
  jmp __alltraps
c010292f:	e9 06 09 00 00       	jmp    c010323a <__alltraps>

c0102934 <vector42>:
.globl vector42
vector42:
  pushl $0
c0102934:	6a 00                	push   $0x0
  pushl $42
c0102936:	6a 2a                	push   $0x2a
  jmp __alltraps
c0102938:	e9 fd 08 00 00       	jmp    c010323a <__alltraps>

c010293d <vector43>:
.globl vector43
vector43:
  pushl $0
c010293d:	6a 00                	push   $0x0
  pushl $43
c010293f:	6a 2b                	push   $0x2b
  jmp __alltraps
c0102941:	e9 f4 08 00 00       	jmp    c010323a <__alltraps>

c0102946 <vector44>:
.globl vector44
vector44:
  pushl $0
c0102946:	6a 00                	push   $0x0
  pushl $44
c0102948:	6a 2c                	push   $0x2c
  jmp __alltraps
c010294a:	e9 eb 08 00 00       	jmp    c010323a <__alltraps>

c010294f <vector45>:
.globl vector45
vector45:
  pushl $0
c010294f:	6a 00                	push   $0x0
  pushl $45
c0102951:	6a 2d                	push   $0x2d
  jmp __alltraps
c0102953:	e9 e2 08 00 00       	jmp    c010323a <__alltraps>

c0102958 <vector46>:
.globl vector46
vector46:
  pushl $0
c0102958:	6a 00                	push   $0x0
  pushl $46
c010295a:	6a 2e                	push   $0x2e
  jmp __alltraps
c010295c:	e9 d9 08 00 00       	jmp    c010323a <__alltraps>

c0102961 <vector47>:
.globl vector47
vector47:
  pushl $0
c0102961:	6a 00                	push   $0x0
  pushl $47
c0102963:	6a 2f                	push   $0x2f
  jmp __alltraps
c0102965:	e9 d0 08 00 00       	jmp    c010323a <__alltraps>

c010296a <vector48>:
.globl vector48
vector48:
  pushl $0
c010296a:	6a 00                	push   $0x0
  pushl $48
c010296c:	6a 30                	push   $0x30
  jmp __alltraps
c010296e:	e9 c7 08 00 00       	jmp    c010323a <__alltraps>

c0102973 <vector49>:
.globl vector49
vector49:
  pushl $0
c0102973:	6a 00                	push   $0x0
  pushl $49
c0102975:	6a 31                	push   $0x31
  jmp __alltraps
c0102977:	e9 be 08 00 00       	jmp    c010323a <__alltraps>

c010297c <vector50>:
.globl vector50
vector50:
  pushl $0
c010297c:	6a 00                	push   $0x0
  pushl $50
c010297e:	6a 32                	push   $0x32
  jmp __alltraps
c0102980:	e9 b5 08 00 00       	jmp    c010323a <__alltraps>

c0102985 <vector51>:
.globl vector51
vector51:
  pushl $0
c0102985:	6a 00                	push   $0x0
  pushl $51
c0102987:	6a 33                	push   $0x33
  jmp __alltraps
c0102989:	e9 ac 08 00 00       	jmp    c010323a <__alltraps>

c010298e <vector52>:
.globl vector52
vector52:
  pushl $0
c010298e:	6a 00                	push   $0x0
  pushl $52
c0102990:	6a 34                	push   $0x34
  jmp __alltraps
c0102992:	e9 a3 08 00 00       	jmp    c010323a <__alltraps>

c0102997 <vector53>:
.globl vector53
vector53:
  pushl $0
c0102997:	6a 00                	push   $0x0
  pushl $53
c0102999:	6a 35                	push   $0x35
  jmp __alltraps
c010299b:	e9 9a 08 00 00       	jmp    c010323a <__alltraps>

c01029a0 <vector54>:
.globl vector54
vector54:
  pushl $0
c01029a0:	6a 00                	push   $0x0
  pushl $54
c01029a2:	6a 36                	push   $0x36
  jmp __alltraps
c01029a4:	e9 91 08 00 00       	jmp    c010323a <__alltraps>

c01029a9 <vector55>:
.globl vector55
vector55:
  pushl $0
c01029a9:	6a 00                	push   $0x0
  pushl $55
c01029ab:	6a 37                	push   $0x37
  jmp __alltraps
c01029ad:	e9 88 08 00 00       	jmp    c010323a <__alltraps>

c01029b2 <vector56>:
.globl vector56
vector56:
  pushl $0
c01029b2:	6a 00                	push   $0x0
  pushl $56
c01029b4:	6a 38                	push   $0x38
  jmp __alltraps
c01029b6:	e9 7f 08 00 00       	jmp    c010323a <__alltraps>

c01029bb <vector57>:
.globl vector57
vector57:
  pushl $0
c01029bb:	6a 00                	push   $0x0
  pushl $57
c01029bd:	6a 39                	push   $0x39
  jmp __alltraps
c01029bf:	e9 76 08 00 00       	jmp    c010323a <__alltraps>

c01029c4 <vector58>:
.globl vector58
vector58:
  pushl $0
c01029c4:	6a 00                	push   $0x0
  pushl $58
c01029c6:	6a 3a                	push   $0x3a
  jmp __alltraps
c01029c8:	e9 6d 08 00 00       	jmp    c010323a <__alltraps>

c01029cd <vector59>:
.globl vector59
vector59:
  pushl $0
c01029cd:	6a 00                	push   $0x0
  pushl $59
c01029cf:	6a 3b                	push   $0x3b
  jmp __alltraps
c01029d1:	e9 64 08 00 00       	jmp    c010323a <__alltraps>

c01029d6 <vector60>:
.globl vector60
vector60:
  pushl $0
c01029d6:	6a 00                	push   $0x0
  pushl $60
c01029d8:	6a 3c                	push   $0x3c
  jmp __alltraps
c01029da:	e9 5b 08 00 00       	jmp    c010323a <__alltraps>

c01029df <vector61>:
.globl vector61
vector61:
  pushl $0
c01029df:	6a 00                	push   $0x0
  pushl $61
c01029e1:	6a 3d                	push   $0x3d
  jmp __alltraps
c01029e3:	e9 52 08 00 00       	jmp    c010323a <__alltraps>

c01029e8 <vector62>:
.globl vector62
vector62:
  pushl $0
c01029e8:	6a 00                	push   $0x0
  pushl $62
c01029ea:	6a 3e                	push   $0x3e
  jmp __alltraps
c01029ec:	e9 49 08 00 00       	jmp    c010323a <__alltraps>

c01029f1 <vector63>:
.globl vector63
vector63:
  pushl $0
c01029f1:	6a 00                	push   $0x0
  pushl $63
c01029f3:	6a 3f                	push   $0x3f
  jmp __alltraps
c01029f5:	e9 40 08 00 00       	jmp    c010323a <__alltraps>

c01029fa <vector64>:
.globl vector64
vector64:
  pushl $0
c01029fa:	6a 00                	push   $0x0
  pushl $64
c01029fc:	6a 40                	push   $0x40
  jmp __alltraps
c01029fe:	e9 37 08 00 00       	jmp    c010323a <__alltraps>

c0102a03 <vector65>:
.globl vector65
vector65:
  pushl $0
c0102a03:	6a 00                	push   $0x0
  pushl $65
c0102a05:	6a 41                	push   $0x41
  jmp __alltraps
c0102a07:	e9 2e 08 00 00       	jmp    c010323a <__alltraps>

c0102a0c <vector66>:
.globl vector66
vector66:
  pushl $0
c0102a0c:	6a 00                	push   $0x0
  pushl $66
c0102a0e:	6a 42                	push   $0x42
  jmp __alltraps
c0102a10:	e9 25 08 00 00       	jmp    c010323a <__alltraps>

c0102a15 <vector67>:
.globl vector67
vector67:
  pushl $0
c0102a15:	6a 00                	push   $0x0
  pushl $67
c0102a17:	6a 43                	push   $0x43
  jmp __alltraps
c0102a19:	e9 1c 08 00 00       	jmp    c010323a <__alltraps>

c0102a1e <vector68>:
.globl vector68
vector68:
  pushl $0
c0102a1e:	6a 00                	push   $0x0
  pushl $68
c0102a20:	6a 44                	push   $0x44
  jmp __alltraps
c0102a22:	e9 13 08 00 00       	jmp    c010323a <__alltraps>

c0102a27 <vector69>:
.globl vector69
vector69:
  pushl $0
c0102a27:	6a 00                	push   $0x0
  pushl $69
c0102a29:	6a 45                	push   $0x45
  jmp __alltraps
c0102a2b:	e9 0a 08 00 00       	jmp    c010323a <__alltraps>

c0102a30 <vector70>:
.globl vector70
vector70:
  pushl $0
c0102a30:	6a 00                	push   $0x0
  pushl $70
c0102a32:	6a 46                	push   $0x46
  jmp __alltraps
c0102a34:	e9 01 08 00 00       	jmp    c010323a <__alltraps>

c0102a39 <vector71>:
.globl vector71
vector71:
  pushl $0
c0102a39:	6a 00                	push   $0x0
  pushl $71
c0102a3b:	6a 47                	push   $0x47
  jmp __alltraps
c0102a3d:	e9 f8 07 00 00       	jmp    c010323a <__alltraps>

c0102a42 <vector72>:
.globl vector72
vector72:
  pushl $0
c0102a42:	6a 00                	push   $0x0
  pushl $72
c0102a44:	6a 48                	push   $0x48
  jmp __alltraps
c0102a46:	e9 ef 07 00 00       	jmp    c010323a <__alltraps>

c0102a4b <vector73>:
.globl vector73
vector73:
  pushl $0
c0102a4b:	6a 00                	push   $0x0
  pushl $73
c0102a4d:	6a 49                	push   $0x49
  jmp __alltraps
c0102a4f:	e9 e6 07 00 00       	jmp    c010323a <__alltraps>

c0102a54 <vector74>:
.globl vector74
vector74:
  pushl $0
c0102a54:	6a 00                	push   $0x0
  pushl $74
c0102a56:	6a 4a                	push   $0x4a
  jmp __alltraps
c0102a58:	e9 dd 07 00 00       	jmp    c010323a <__alltraps>

c0102a5d <vector75>:
.globl vector75
vector75:
  pushl $0
c0102a5d:	6a 00                	push   $0x0
  pushl $75
c0102a5f:	6a 4b                	push   $0x4b
  jmp __alltraps
c0102a61:	e9 d4 07 00 00       	jmp    c010323a <__alltraps>

c0102a66 <vector76>:
.globl vector76
vector76:
  pushl $0
c0102a66:	6a 00                	push   $0x0
  pushl $76
c0102a68:	6a 4c                	push   $0x4c
  jmp __alltraps
c0102a6a:	e9 cb 07 00 00       	jmp    c010323a <__alltraps>

c0102a6f <vector77>:
.globl vector77
vector77:
  pushl $0
c0102a6f:	6a 00                	push   $0x0
  pushl $77
c0102a71:	6a 4d                	push   $0x4d
  jmp __alltraps
c0102a73:	e9 c2 07 00 00       	jmp    c010323a <__alltraps>

c0102a78 <vector78>:
.globl vector78
vector78:
  pushl $0
c0102a78:	6a 00                	push   $0x0
  pushl $78
c0102a7a:	6a 4e                	push   $0x4e
  jmp __alltraps
c0102a7c:	e9 b9 07 00 00       	jmp    c010323a <__alltraps>

c0102a81 <vector79>:
.globl vector79
vector79:
  pushl $0
c0102a81:	6a 00                	push   $0x0
  pushl $79
c0102a83:	6a 4f                	push   $0x4f
  jmp __alltraps
c0102a85:	e9 b0 07 00 00       	jmp    c010323a <__alltraps>

c0102a8a <vector80>:
.globl vector80
vector80:
  pushl $0
c0102a8a:	6a 00                	push   $0x0
  pushl $80
c0102a8c:	6a 50                	push   $0x50
  jmp __alltraps
c0102a8e:	e9 a7 07 00 00       	jmp    c010323a <__alltraps>

c0102a93 <vector81>:
.globl vector81
vector81:
  pushl $0
c0102a93:	6a 00                	push   $0x0
  pushl $81
c0102a95:	6a 51                	push   $0x51
  jmp __alltraps
c0102a97:	e9 9e 07 00 00       	jmp    c010323a <__alltraps>

c0102a9c <vector82>:
.globl vector82
vector82:
  pushl $0
c0102a9c:	6a 00                	push   $0x0
  pushl $82
c0102a9e:	6a 52                	push   $0x52
  jmp __alltraps
c0102aa0:	e9 95 07 00 00       	jmp    c010323a <__alltraps>

c0102aa5 <vector83>:
.globl vector83
vector83:
  pushl $0
c0102aa5:	6a 00                	push   $0x0
  pushl $83
c0102aa7:	6a 53                	push   $0x53
  jmp __alltraps
c0102aa9:	e9 8c 07 00 00       	jmp    c010323a <__alltraps>

c0102aae <vector84>:
.globl vector84
vector84:
  pushl $0
c0102aae:	6a 00                	push   $0x0
  pushl $84
c0102ab0:	6a 54                	push   $0x54
  jmp __alltraps
c0102ab2:	e9 83 07 00 00       	jmp    c010323a <__alltraps>

c0102ab7 <vector85>:
.globl vector85
vector85:
  pushl $0
c0102ab7:	6a 00                	push   $0x0
  pushl $85
c0102ab9:	6a 55                	push   $0x55
  jmp __alltraps
c0102abb:	e9 7a 07 00 00       	jmp    c010323a <__alltraps>

c0102ac0 <vector86>:
.globl vector86
vector86:
  pushl $0
c0102ac0:	6a 00                	push   $0x0
  pushl $86
c0102ac2:	6a 56                	push   $0x56
  jmp __alltraps
c0102ac4:	e9 71 07 00 00       	jmp    c010323a <__alltraps>

c0102ac9 <vector87>:
.globl vector87
vector87:
  pushl $0
c0102ac9:	6a 00                	push   $0x0
  pushl $87
c0102acb:	6a 57                	push   $0x57
  jmp __alltraps
c0102acd:	e9 68 07 00 00       	jmp    c010323a <__alltraps>

c0102ad2 <vector88>:
.globl vector88
vector88:
  pushl $0
c0102ad2:	6a 00                	push   $0x0
  pushl $88
c0102ad4:	6a 58                	push   $0x58
  jmp __alltraps
c0102ad6:	e9 5f 07 00 00       	jmp    c010323a <__alltraps>

c0102adb <vector89>:
.globl vector89
vector89:
  pushl $0
c0102adb:	6a 00                	push   $0x0
  pushl $89
c0102add:	6a 59                	push   $0x59
  jmp __alltraps
c0102adf:	e9 56 07 00 00       	jmp    c010323a <__alltraps>

c0102ae4 <vector90>:
.globl vector90
vector90:
  pushl $0
c0102ae4:	6a 00                	push   $0x0
  pushl $90
c0102ae6:	6a 5a                	push   $0x5a
  jmp __alltraps
c0102ae8:	e9 4d 07 00 00       	jmp    c010323a <__alltraps>

c0102aed <vector91>:
.globl vector91
vector91:
  pushl $0
c0102aed:	6a 00                	push   $0x0
  pushl $91
c0102aef:	6a 5b                	push   $0x5b
  jmp __alltraps
c0102af1:	e9 44 07 00 00       	jmp    c010323a <__alltraps>

c0102af6 <vector92>:
.globl vector92
vector92:
  pushl $0
c0102af6:	6a 00                	push   $0x0
  pushl $92
c0102af8:	6a 5c                	push   $0x5c
  jmp __alltraps
c0102afa:	e9 3b 07 00 00       	jmp    c010323a <__alltraps>

c0102aff <vector93>:
.globl vector93
vector93:
  pushl $0
c0102aff:	6a 00                	push   $0x0
  pushl $93
c0102b01:	6a 5d                	push   $0x5d
  jmp __alltraps
c0102b03:	e9 32 07 00 00       	jmp    c010323a <__alltraps>

c0102b08 <vector94>:
.globl vector94
vector94:
  pushl $0
c0102b08:	6a 00                	push   $0x0
  pushl $94
c0102b0a:	6a 5e                	push   $0x5e
  jmp __alltraps
c0102b0c:	e9 29 07 00 00       	jmp    c010323a <__alltraps>

c0102b11 <vector95>:
.globl vector95
vector95:
  pushl $0
c0102b11:	6a 00                	push   $0x0
  pushl $95
c0102b13:	6a 5f                	push   $0x5f
  jmp __alltraps
c0102b15:	e9 20 07 00 00       	jmp    c010323a <__alltraps>

c0102b1a <vector96>:
.globl vector96
vector96:
  pushl $0
c0102b1a:	6a 00                	push   $0x0
  pushl $96
c0102b1c:	6a 60                	push   $0x60
  jmp __alltraps
c0102b1e:	e9 17 07 00 00       	jmp    c010323a <__alltraps>

c0102b23 <vector97>:
.globl vector97
vector97:
  pushl $0
c0102b23:	6a 00                	push   $0x0
  pushl $97
c0102b25:	6a 61                	push   $0x61
  jmp __alltraps
c0102b27:	e9 0e 07 00 00       	jmp    c010323a <__alltraps>

c0102b2c <vector98>:
.globl vector98
vector98:
  pushl $0
c0102b2c:	6a 00                	push   $0x0
  pushl $98
c0102b2e:	6a 62                	push   $0x62
  jmp __alltraps
c0102b30:	e9 05 07 00 00       	jmp    c010323a <__alltraps>

c0102b35 <vector99>:
.globl vector99
vector99:
  pushl $0
c0102b35:	6a 00                	push   $0x0
  pushl $99
c0102b37:	6a 63                	push   $0x63
  jmp __alltraps
c0102b39:	e9 fc 06 00 00       	jmp    c010323a <__alltraps>

c0102b3e <vector100>:
.globl vector100
vector100:
  pushl $0
c0102b3e:	6a 00                	push   $0x0
  pushl $100
c0102b40:	6a 64                	push   $0x64
  jmp __alltraps
c0102b42:	e9 f3 06 00 00       	jmp    c010323a <__alltraps>

c0102b47 <vector101>:
.globl vector101
vector101:
  pushl $0
c0102b47:	6a 00                	push   $0x0
  pushl $101
c0102b49:	6a 65                	push   $0x65
  jmp __alltraps
c0102b4b:	e9 ea 06 00 00       	jmp    c010323a <__alltraps>

c0102b50 <vector102>:
.globl vector102
vector102:
  pushl $0
c0102b50:	6a 00                	push   $0x0
  pushl $102
c0102b52:	6a 66                	push   $0x66
  jmp __alltraps
c0102b54:	e9 e1 06 00 00       	jmp    c010323a <__alltraps>

c0102b59 <vector103>:
.globl vector103
vector103:
  pushl $0
c0102b59:	6a 00                	push   $0x0
  pushl $103
c0102b5b:	6a 67                	push   $0x67
  jmp __alltraps
c0102b5d:	e9 d8 06 00 00       	jmp    c010323a <__alltraps>

c0102b62 <vector104>:
.globl vector104
vector104:
  pushl $0
c0102b62:	6a 00                	push   $0x0
  pushl $104
c0102b64:	6a 68                	push   $0x68
  jmp __alltraps
c0102b66:	e9 cf 06 00 00       	jmp    c010323a <__alltraps>

c0102b6b <vector105>:
.globl vector105
vector105:
  pushl $0
c0102b6b:	6a 00                	push   $0x0
  pushl $105
c0102b6d:	6a 69                	push   $0x69
  jmp __alltraps
c0102b6f:	e9 c6 06 00 00       	jmp    c010323a <__alltraps>

c0102b74 <vector106>:
.globl vector106
vector106:
  pushl $0
c0102b74:	6a 00                	push   $0x0
  pushl $106
c0102b76:	6a 6a                	push   $0x6a
  jmp __alltraps
c0102b78:	e9 bd 06 00 00       	jmp    c010323a <__alltraps>

c0102b7d <vector107>:
.globl vector107
vector107:
  pushl $0
c0102b7d:	6a 00                	push   $0x0
  pushl $107
c0102b7f:	6a 6b                	push   $0x6b
  jmp __alltraps
c0102b81:	e9 b4 06 00 00       	jmp    c010323a <__alltraps>

c0102b86 <vector108>:
.globl vector108
vector108:
  pushl $0
c0102b86:	6a 00                	push   $0x0
  pushl $108
c0102b88:	6a 6c                	push   $0x6c
  jmp __alltraps
c0102b8a:	e9 ab 06 00 00       	jmp    c010323a <__alltraps>

c0102b8f <vector109>:
.globl vector109
vector109:
  pushl $0
c0102b8f:	6a 00                	push   $0x0
  pushl $109
c0102b91:	6a 6d                	push   $0x6d
  jmp __alltraps
c0102b93:	e9 a2 06 00 00       	jmp    c010323a <__alltraps>

c0102b98 <vector110>:
.globl vector110
vector110:
  pushl $0
c0102b98:	6a 00                	push   $0x0
  pushl $110
c0102b9a:	6a 6e                	push   $0x6e
  jmp __alltraps
c0102b9c:	e9 99 06 00 00       	jmp    c010323a <__alltraps>

c0102ba1 <vector111>:
.globl vector111
vector111:
  pushl $0
c0102ba1:	6a 00                	push   $0x0
  pushl $111
c0102ba3:	6a 6f                	push   $0x6f
  jmp __alltraps
c0102ba5:	e9 90 06 00 00       	jmp    c010323a <__alltraps>

c0102baa <vector112>:
.globl vector112
vector112:
  pushl $0
c0102baa:	6a 00                	push   $0x0
  pushl $112
c0102bac:	6a 70                	push   $0x70
  jmp __alltraps
c0102bae:	e9 87 06 00 00       	jmp    c010323a <__alltraps>

c0102bb3 <vector113>:
.globl vector113
vector113:
  pushl $0
c0102bb3:	6a 00                	push   $0x0
  pushl $113
c0102bb5:	6a 71                	push   $0x71
  jmp __alltraps
c0102bb7:	e9 7e 06 00 00       	jmp    c010323a <__alltraps>

c0102bbc <vector114>:
.globl vector114
vector114:
  pushl $0
c0102bbc:	6a 00                	push   $0x0
  pushl $114
c0102bbe:	6a 72                	push   $0x72
  jmp __alltraps
c0102bc0:	e9 75 06 00 00       	jmp    c010323a <__alltraps>

c0102bc5 <vector115>:
.globl vector115
vector115:
  pushl $0
c0102bc5:	6a 00                	push   $0x0
  pushl $115
c0102bc7:	6a 73                	push   $0x73
  jmp __alltraps
c0102bc9:	e9 6c 06 00 00       	jmp    c010323a <__alltraps>

c0102bce <vector116>:
.globl vector116
vector116:
  pushl $0
c0102bce:	6a 00                	push   $0x0
  pushl $116
c0102bd0:	6a 74                	push   $0x74
  jmp __alltraps
c0102bd2:	e9 63 06 00 00       	jmp    c010323a <__alltraps>

c0102bd7 <vector117>:
.globl vector117
vector117:
  pushl $0
c0102bd7:	6a 00                	push   $0x0
  pushl $117
c0102bd9:	6a 75                	push   $0x75
  jmp __alltraps
c0102bdb:	e9 5a 06 00 00       	jmp    c010323a <__alltraps>

c0102be0 <vector118>:
.globl vector118
vector118:
  pushl $0
c0102be0:	6a 00                	push   $0x0
  pushl $118
c0102be2:	6a 76                	push   $0x76
  jmp __alltraps
c0102be4:	e9 51 06 00 00       	jmp    c010323a <__alltraps>

c0102be9 <vector119>:
.globl vector119
vector119:
  pushl $0
c0102be9:	6a 00                	push   $0x0
  pushl $119
c0102beb:	6a 77                	push   $0x77
  jmp __alltraps
c0102bed:	e9 48 06 00 00       	jmp    c010323a <__alltraps>

c0102bf2 <vector120>:
.globl vector120
vector120:
  pushl $0
c0102bf2:	6a 00                	push   $0x0
  pushl $120
c0102bf4:	6a 78                	push   $0x78
  jmp __alltraps
c0102bf6:	e9 3f 06 00 00       	jmp    c010323a <__alltraps>

c0102bfb <vector121>:
.globl vector121
vector121:
  pushl $0
c0102bfb:	6a 00                	push   $0x0
  pushl $121
c0102bfd:	6a 79                	push   $0x79
  jmp __alltraps
c0102bff:	e9 36 06 00 00       	jmp    c010323a <__alltraps>

c0102c04 <vector122>:
.globl vector122
vector122:
  pushl $0
c0102c04:	6a 00                	push   $0x0
  pushl $122
c0102c06:	6a 7a                	push   $0x7a
  jmp __alltraps
c0102c08:	e9 2d 06 00 00       	jmp    c010323a <__alltraps>

c0102c0d <vector123>:
.globl vector123
vector123:
  pushl $0
c0102c0d:	6a 00                	push   $0x0
  pushl $123
c0102c0f:	6a 7b                	push   $0x7b
  jmp __alltraps
c0102c11:	e9 24 06 00 00       	jmp    c010323a <__alltraps>

c0102c16 <vector124>:
.globl vector124
vector124:
  pushl $0
c0102c16:	6a 00                	push   $0x0
  pushl $124
c0102c18:	6a 7c                	push   $0x7c
  jmp __alltraps
c0102c1a:	e9 1b 06 00 00       	jmp    c010323a <__alltraps>

c0102c1f <vector125>:
.globl vector125
vector125:
  pushl $0
c0102c1f:	6a 00                	push   $0x0
  pushl $125
c0102c21:	6a 7d                	push   $0x7d
  jmp __alltraps
c0102c23:	e9 12 06 00 00       	jmp    c010323a <__alltraps>

c0102c28 <vector126>:
.globl vector126
vector126:
  pushl $0
c0102c28:	6a 00                	push   $0x0
  pushl $126
c0102c2a:	6a 7e                	push   $0x7e
  jmp __alltraps
c0102c2c:	e9 09 06 00 00       	jmp    c010323a <__alltraps>

c0102c31 <vector127>:
.globl vector127
vector127:
  pushl $0
c0102c31:	6a 00                	push   $0x0
  pushl $127
c0102c33:	6a 7f                	push   $0x7f
  jmp __alltraps
c0102c35:	e9 00 06 00 00       	jmp    c010323a <__alltraps>

c0102c3a <vector128>:
.globl vector128
vector128:
  pushl $0
c0102c3a:	6a 00                	push   $0x0
  pushl $128
c0102c3c:	68 80 00 00 00       	push   $0x80
  jmp __alltraps
c0102c41:	e9 f4 05 00 00       	jmp    c010323a <__alltraps>

c0102c46 <vector129>:
.globl vector129
vector129:
  pushl $0
c0102c46:	6a 00                	push   $0x0
  pushl $129
c0102c48:	68 81 00 00 00       	push   $0x81
  jmp __alltraps
c0102c4d:	e9 e8 05 00 00       	jmp    c010323a <__alltraps>

c0102c52 <vector130>:
.globl vector130
vector130:
  pushl $0
c0102c52:	6a 00                	push   $0x0
  pushl $130
c0102c54:	68 82 00 00 00       	push   $0x82
  jmp __alltraps
c0102c59:	e9 dc 05 00 00       	jmp    c010323a <__alltraps>

c0102c5e <vector131>:
.globl vector131
vector131:
  pushl $0
c0102c5e:	6a 00                	push   $0x0
  pushl $131
c0102c60:	68 83 00 00 00       	push   $0x83
  jmp __alltraps
c0102c65:	e9 d0 05 00 00       	jmp    c010323a <__alltraps>

c0102c6a <vector132>:
.globl vector132
vector132:
  pushl $0
c0102c6a:	6a 00                	push   $0x0
  pushl $132
c0102c6c:	68 84 00 00 00       	push   $0x84
  jmp __alltraps
c0102c71:	e9 c4 05 00 00       	jmp    c010323a <__alltraps>

c0102c76 <vector133>:
.globl vector133
vector133:
  pushl $0
c0102c76:	6a 00                	push   $0x0
  pushl $133
c0102c78:	68 85 00 00 00       	push   $0x85
  jmp __alltraps
c0102c7d:	e9 b8 05 00 00       	jmp    c010323a <__alltraps>

c0102c82 <vector134>:
.globl vector134
vector134:
  pushl $0
c0102c82:	6a 00                	push   $0x0
  pushl $134
c0102c84:	68 86 00 00 00       	push   $0x86
  jmp __alltraps
c0102c89:	e9 ac 05 00 00       	jmp    c010323a <__alltraps>

c0102c8e <vector135>:
.globl vector135
vector135:
  pushl $0
c0102c8e:	6a 00                	push   $0x0
  pushl $135
c0102c90:	68 87 00 00 00       	push   $0x87
  jmp __alltraps
c0102c95:	e9 a0 05 00 00       	jmp    c010323a <__alltraps>

c0102c9a <vector136>:
.globl vector136
vector136:
  pushl $0
c0102c9a:	6a 00                	push   $0x0
  pushl $136
c0102c9c:	68 88 00 00 00       	push   $0x88
  jmp __alltraps
c0102ca1:	e9 94 05 00 00       	jmp    c010323a <__alltraps>

c0102ca6 <vector137>:
.globl vector137
vector137:
  pushl $0
c0102ca6:	6a 00                	push   $0x0
  pushl $137
c0102ca8:	68 89 00 00 00       	push   $0x89
  jmp __alltraps
c0102cad:	e9 88 05 00 00       	jmp    c010323a <__alltraps>

c0102cb2 <vector138>:
.globl vector138
vector138:
  pushl $0
c0102cb2:	6a 00                	push   $0x0
  pushl $138
c0102cb4:	68 8a 00 00 00       	push   $0x8a
  jmp __alltraps
c0102cb9:	e9 7c 05 00 00       	jmp    c010323a <__alltraps>

c0102cbe <vector139>:
.globl vector139
vector139:
  pushl $0
c0102cbe:	6a 00                	push   $0x0
  pushl $139
c0102cc0:	68 8b 00 00 00       	push   $0x8b
  jmp __alltraps
c0102cc5:	e9 70 05 00 00       	jmp    c010323a <__alltraps>

c0102cca <vector140>:
.globl vector140
vector140:
  pushl $0
c0102cca:	6a 00                	push   $0x0
  pushl $140
c0102ccc:	68 8c 00 00 00       	push   $0x8c
  jmp __alltraps
c0102cd1:	e9 64 05 00 00       	jmp    c010323a <__alltraps>

c0102cd6 <vector141>:
.globl vector141
vector141:
  pushl $0
c0102cd6:	6a 00                	push   $0x0
  pushl $141
c0102cd8:	68 8d 00 00 00       	push   $0x8d
  jmp __alltraps
c0102cdd:	e9 58 05 00 00       	jmp    c010323a <__alltraps>

c0102ce2 <vector142>:
.globl vector142
vector142:
  pushl $0
c0102ce2:	6a 00                	push   $0x0
  pushl $142
c0102ce4:	68 8e 00 00 00       	push   $0x8e
  jmp __alltraps
c0102ce9:	e9 4c 05 00 00       	jmp    c010323a <__alltraps>

c0102cee <vector143>:
.globl vector143
vector143:
  pushl $0
c0102cee:	6a 00                	push   $0x0
  pushl $143
c0102cf0:	68 8f 00 00 00       	push   $0x8f
  jmp __alltraps
c0102cf5:	e9 40 05 00 00       	jmp    c010323a <__alltraps>

c0102cfa <vector144>:
.globl vector144
vector144:
  pushl $0
c0102cfa:	6a 00                	push   $0x0
  pushl $144
c0102cfc:	68 90 00 00 00       	push   $0x90
  jmp __alltraps
c0102d01:	e9 34 05 00 00       	jmp    c010323a <__alltraps>

c0102d06 <vector145>:
.globl vector145
vector145:
  pushl $0
c0102d06:	6a 00                	push   $0x0
  pushl $145
c0102d08:	68 91 00 00 00       	push   $0x91
  jmp __alltraps
c0102d0d:	e9 28 05 00 00       	jmp    c010323a <__alltraps>

c0102d12 <vector146>:
.globl vector146
vector146:
  pushl $0
c0102d12:	6a 00                	push   $0x0
  pushl $146
c0102d14:	68 92 00 00 00       	push   $0x92
  jmp __alltraps
c0102d19:	e9 1c 05 00 00       	jmp    c010323a <__alltraps>

c0102d1e <vector147>:
.globl vector147
vector147:
  pushl $0
c0102d1e:	6a 00                	push   $0x0
  pushl $147
c0102d20:	68 93 00 00 00       	push   $0x93
  jmp __alltraps
c0102d25:	e9 10 05 00 00       	jmp    c010323a <__alltraps>

c0102d2a <vector148>:
.globl vector148
vector148:
  pushl $0
c0102d2a:	6a 00                	push   $0x0
  pushl $148
c0102d2c:	68 94 00 00 00       	push   $0x94
  jmp __alltraps
c0102d31:	e9 04 05 00 00       	jmp    c010323a <__alltraps>

c0102d36 <vector149>:
.globl vector149
vector149:
  pushl $0
c0102d36:	6a 00                	push   $0x0
  pushl $149
c0102d38:	68 95 00 00 00       	push   $0x95
  jmp __alltraps
c0102d3d:	e9 f8 04 00 00       	jmp    c010323a <__alltraps>

c0102d42 <vector150>:
.globl vector150
vector150:
  pushl $0
c0102d42:	6a 00                	push   $0x0
  pushl $150
c0102d44:	68 96 00 00 00       	push   $0x96
  jmp __alltraps
c0102d49:	e9 ec 04 00 00       	jmp    c010323a <__alltraps>

c0102d4e <vector151>:
.globl vector151
vector151:
  pushl $0
c0102d4e:	6a 00                	push   $0x0
  pushl $151
c0102d50:	68 97 00 00 00       	push   $0x97
  jmp __alltraps
c0102d55:	e9 e0 04 00 00       	jmp    c010323a <__alltraps>

c0102d5a <vector152>:
.globl vector152
vector152:
  pushl $0
c0102d5a:	6a 00                	push   $0x0
  pushl $152
c0102d5c:	68 98 00 00 00       	push   $0x98
  jmp __alltraps
c0102d61:	e9 d4 04 00 00       	jmp    c010323a <__alltraps>

c0102d66 <vector153>:
.globl vector153
vector153:
  pushl $0
c0102d66:	6a 00                	push   $0x0
  pushl $153
c0102d68:	68 99 00 00 00       	push   $0x99
  jmp __alltraps
c0102d6d:	e9 c8 04 00 00       	jmp    c010323a <__alltraps>

c0102d72 <vector154>:
.globl vector154
vector154:
  pushl $0
c0102d72:	6a 00                	push   $0x0
  pushl $154
c0102d74:	68 9a 00 00 00       	push   $0x9a
  jmp __alltraps
c0102d79:	e9 bc 04 00 00       	jmp    c010323a <__alltraps>

c0102d7e <vector155>:
.globl vector155
vector155:
  pushl $0
c0102d7e:	6a 00                	push   $0x0
  pushl $155
c0102d80:	68 9b 00 00 00       	push   $0x9b
  jmp __alltraps
c0102d85:	e9 b0 04 00 00       	jmp    c010323a <__alltraps>

c0102d8a <vector156>:
.globl vector156
vector156:
  pushl $0
c0102d8a:	6a 00                	push   $0x0
  pushl $156
c0102d8c:	68 9c 00 00 00       	push   $0x9c
  jmp __alltraps
c0102d91:	e9 a4 04 00 00       	jmp    c010323a <__alltraps>

c0102d96 <vector157>:
.globl vector157
vector157:
  pushl $0
c0102d96:	6a 00                	push   $0x0
  pushl $157
c0102d98:	68 9d 00 00 00       	push   $0x9d
  jmp __alltraps
c0102d9d:	e9 98 04 00 00       	jmp    c010323a <__alltraps>

c0102da2 <vector158>:
.globl vector158
vector158:
  pushl $0
c0102da2:	6a 00                	push   $0x0
  pushl $158
c0102da4:	68 9e 00 00 00       	push   $0x9e
  jmp __alltraps
c0102da9:	e9 8c 04 00 00       	jmp    c010323a <__alltraps>

c0102dae <vector159>:
.globl vector159
vector159:
  pushl $0
c0102dae:	6a 00                	push   $0x0
  pushl $159
c0102db0:	68 9f 00 00 00       	push   $0x9f
  jmp __alltraps
c0102db5:	e9 80 04 00 00       	jmp    c010323a <__alltraps>

c0102dba <vector160>:
.globl vector160
vector160:
  pushl $0
c0102dba:	6a 00                	push   $0x0
  pushl $160
c0102dbc:	68 a0 00 00 00       	push   $0xa0
  jmp __alltraps
c0102dc1:	e9 74 04 00 00       	jmp    c010323a <__alltraps>

c0102dc6 <vector161>:
.globl vector161
vector161:
  pushl $0
c0102dc6:	6a 00                	push   $0x0
  pushl $161
c0102dc8:	68 a1 00 00 00       	push   $0xa1
  jmp __alltraps
c0102dcd:	e9 68 04 00 00       	jmp    c010323a <__alltraps>

c0102dd2 <vector162>:
.globl vector162
vector162:
  pushl $0
c0102dd2:	6a 00                	push   $0x0
  pushl $162
c0102dd4:	68 a2 00 00 00       	push   $0xa2
  jmp __alltraps
c0102dd9:	e9 5c 04 00 00       	jmp    c010323a <__alltraps>

c0102dde <vector163>:
.globl vector163
vector163:
  pushl $0
c0102dde:	6a 00                	push   $0x0
  pushl $163
c0102de0:	68 a3 00 00 00       	push   $0xa3
  jmp __alltraps
c0102de5:	e9 50 04 00 00       	jmp    c010323a <__alltraps>

c0102dea <vector164>:
.globl vector164
vector164:
  pushl $0
c0102dea:	6a 00                	push   $0x0
  pushl $164
c0102dec:	68 a4 00 00 00       	push   $0xa4
  jmp __alltraps
c0102df1:	e9 44 04 00 00       	jmp    c010323a <__alltraps>

c0102df6 <vector165>:
.globl vector165
vector165:
  pushl $0
c0102df6:	6a 00                	push   $0x0
  pushl $165
c0102df8:	68 a5 00 00 00       	push   $0xa5
  jmp __alltraps
c0102dfd:	e9 38 04 00 00       	jmp    c010323a <__alltraps>

c0102e02 <vector166>:
.globl vector166
vector166:
  pushl $0
c0102e02:	6a 00                	push   $0x0
  pushl $166
c0102e04:	68 a6 00 00 00       	push   $0xa6
  jmp __alltraps
c0102e09:	e9 2c 04 00 00       	jmp    c010323a <__alltraps>

c0102e0e <vector167>:
.globl vector167
vector167:
  pushl $0
c0102e0e:	6a 00                	push   $0x0
  pushl $167
c0102e10:	68 a7 00 00 00       	push   $0xa7
  jmp __alltraps
c0102e15:	e9 20 04 00 00       	jmp    c010323a <__alltraps>

c0102e1a <vector168>:
.globl vector168
vector168:
  pushl $0
c0102e1a:	6a 00                	push   $0x0
  pushl $168
c0102e1c:	68 a8 00 00 00       	push   $0xa8
  jmp __alltraps
c0102e21:	e9 14 04 00 00       	jmp    c010323a <__alltraps>

c0102e26 <vector169>:
.globl vector169
vector169:
  pushl $0
c0102e26:	6a 00                	push   $0x0
  pushl $169
c0102e28:	68 a9 00 00 00       	push   $0xa9
  jmp __alltraps
c0102e2d:	e9 08 04 00 00       	jmp    c010323a <__alltraps>

c0102e32 <vector170>:
.globl vector170
vector170:
  pushl $0
c0102e32:	6a 00                	push   $0x0
  pushl $170
c0102e34:	68 aa 00 00 00       	push   $0xaa
  jmp __alltraps
c0102e39:	e9 fc 03 00 00       	jmp    c010323a <__alltraps>

c0102e3e <vector171>:
.globl vector171
vector171:
  pushl $0
c0102e3e:	6a 00                	push   $0x0
  pushl $171
c0102e40:	68 ab 00 00 00       	push   $0xab
  jmp __alltraps
c0102e45:	e9 f0 03 00 00       	jmp    c010323a <__alltraps>

c0102e4a <vector172>:
.globl vector172
vector172:
  pushl $0
c0102e4a:	6a 00                	push   $0x0
  pushl $172
c0102e4c:	68 ac 00 00 00       	push   $0xac
  jmp __alltraps
c0102e51:	e9 e4 03 00 00       	jmp    c010323a <__alltraps>

c0102e56 <vector173>:
.globl vector173
vector173:
  pushl $0
c0102e56:	6a 00                	push   $0x0
  pushl $173
c0102e58:	68 ad 00 00 00       	push   $0xad
  jmp __alltraps
c0102e5d:	e9 d8 03 00 00       	jmp    c010323a <__alltraps>

c0102e62 <vector174>:
.globl vector174
vector174:
  pushl $0
c0102e62:	6a 00                	push   $0x0
  pushl $174
c0102e64:	68 ae 00 00 00       	push   $0xae
  jmp __alltraps
c0102e69:	e9 cc 03 00 00       	jmp    c010323a <__alltraps>

c0102e6e <vector175>:
.globl vector175
vector175:
  pushl $0
c0102e6e:	6a 00                	push   $0x0
  pushl $175
c0102e70:	68 af 00 00 00       	push   $0xaf
  jmp __alltraps
c0102e75:	e9 c0 03 00 00       	jmp    c010323a <__alltraps>

c0102e7a <vector176>:
.globl vector176
vector176:
  pushl $0
c0102e7a:	6a 00                	push   $0x0
  pushl $176
c0102e7c:	68 b0 00 00 00       	push   $0xb0
  jmp __alltraps
c0102e81:	e9 b4 03 00 00       	jmp    c010323a <__alltraps>

c0102e86 <vector177>:
.globl vector177
vector177:
  pushl $0
c0102e86:	6a 00                	push   $0x0
  pushl $177
c0102e88:	68 b1 00 00 00       	push   $0xb1
  jmp __alltraps
c0102e8d:	e9 a8 03 00 00       	jmp    c010323a <__alltraps>

c0102e92 <vector178>:
.globl vector178
vector178:
  pushl $0
c0102e92:	6a 00                	push   $0x0
  pushl $178
c0102e94:	68 b2 00 00 00       	push   $0xb2
  jmp __alltraps
c0102e99:	e9 9c 03 00 00       	jmp    c010323a <__alltraps>

c0102e9e <vector179>:
.globl vector179
vector179:
  pushl $0
c0102e9e:	6a 00                	push   $0x0
  pushl $179
c0102ea0:	68 b3 00 00 00       	push   $0xb3
  jmp __alltraps
c0102ea5:	e9 90 03 00 00       	jmp    c010323a <__alltraps>

c0102eaa <vector180>:
.globl vector180
vector180:
  pushl $0
c0102eaa:	6a 00                	push   $0x0
  pushl $180
c0102eac:	68 b4 00 00 00       	push   $0xb4
  jmp __alltraps
c0102eb1:	e9 84 03 00 00       	jmp    c010323a <__alltraps>

c0102eb6 <vector181>:
.globl vector181
vector181:
  pushl $0
c0102eb6:	6a 00                	push   $0x0
  pushl $181
c0102eb8:	68 b5 00 00 00       	push   $0xb5
  jmp __alltraps
c0102ebd:	e9 78 03 00 00       	jmp    c010323a <__alltraps>

c0102ec2 <vector182>:
.globl vector182
vector182:
  pushl $0
c0102ec2:	6a 00                	push   $0x0
  pushl $182
c0102ec4:	68 b6 00 00 00       	push   $0xb6
  jmp __alltraps
c0102ec9:	e9 6c 03 00 00       	jmp    c010323a <__alltraps>

c0102ece <vector183>:
.globl vector183
vector183:
  pushl $0
c0102ece:	6a 00                	push   $0x0
  pushl $183
c0102ed0:	68 b7 00 00 00       	push   $0xb7
  jmp __alltraps
c0102ed5:	e9 60 03 00 00       	jmp    c010323a <__alltraps>

c0102eda <vector184>:
.globl vector184
vector184:
  pushl $0
c0102eda:	6a 00                	push   $0x0
  pushl $184
c0102edc:	68 b8 00 00 00       	push   $0xb8
  jmp __alltraps
c0102ee1:	e9 54 03 00 00       	jmp    c010323a <__alltraps>

c0102ee6 <vector185>:
.globl vector185
vector185:
  pushl $0
c0102ee6:	6a 00                	push   $0x0
  pushl $185
c0102ee8:	68 b9 00 00 00       	push   $0xb9
  jmp __alltraps
c0102eed:	e9 48 03 00 00       	jmp    c010323a <__alltraps>

c0102ef2 <vector186>:
.globl vector186
vector186:
  pushl $0
c0102ef2:	6a 00                	push   $0x0
  pushl $186
c0102ef4:	68 ba 00 00 00       	push   $0xba
  jmp __alltraps
c0102ef9:	e9 3c 03 00 00       	jmp    c010323a <__alltraps>

c0102efe <vector187>:
.globl vector187
vector187:
  pushl $0
c0102efe:	6a 00                	push   $0x0
  pushl $187
c0102f00:	68 bb 00 00 00       	push   $0xbb
  jmp __alltraps
c0102f05:	e9 30 03 00 00       	jmp    c010323a <__alltraps>

c0102f0a <vector188>:
.globl vector188
vector188:
  pushl $0
c0102f0a:	6a 00                	push   $0x0
  pushl $188
c0102f0c:	68 bc 00 00 00       	push   $0xbc
  jmp __alltraps
c0102f11:	e9 24 03 00 00       	jmp    c010323a <__alltraps>

c0102f16 <vector189>:
.globl vector189
vector189:
  pushl $0
c0102f16:	6a 00                	push   $0x0
  pushl $189
c0102f18:	68 bd 00 00 00       	push   $0xbd
  jmp __alltraps
c0102f1d:	e9 18 03 00 00       	jmp    c010323a <__alltraps>

c0102f22 <vector190>:
.globl vector190
vector190:
  pushl $0
c0102f22:	6a 00                	push   $0x0
  pushl $190
c0102f24:	68 be 00 00 00       	push   $0xbe
  jmp __alltraps
c0102f29:	e9 0c 03 00 00       	jmp    c010323a <__alltraps>

c0102f2e <vector191>:
.globl vector191
vector191:
  pushl $0
c0102f2e:	6a 00                	push   $0x0
  pushl $191
c0102f30:	68 bf 00 00 00       	push   $0xbf
  jmp __alltraps
c0102f35:	e9 00 03 00 00       	jmp    c010323a <__alltraps>

c0102f3a <vector192>:
.globl vector192
vector192:
  pushl $0
c0102f3a:	6a 00                	push   $0x0
  pushl $192
c0102f3c:	68 c0 00 00 00       	push   $0xc0
  jmp __alltraps
c0102f41:	e9 f4 02 00 00       	jmp    c010323a <__alltraps>

c0102f46 <vector193>:
.globl vector193
vector193:
  pushl $0
c0102f46:	6a 00                	push   $0x0
  pushl $193
c0102f48:	68 c1 00 00 00       	push   $0xc1
  jmp __alltraps
c0102f4d:	e9 e8 02 00 00       	jmp    c010323a <__alltraps>

c0102f52 <vector194>:
.globl vector194
vector194:
  pushl $0
c0102f52:	6a 00                	push   $0x0
  pushl $194
c0102f54:	68 c2 00 00 00       	push   $0xc2
  jmp __alltraps
c0102f59:	e9 dc 02 00 00       	jmp    c010323a <__alltraps>

c0102f5e <vector195>:
.globl vector195
vector195:
  pushl $0
c0102f5e:	6a 00                	push   $0x0
  pushl $195
c0102f60:	68 c3 00 00 00       	push   $0xc3
  jmp __alltraps
c0102f65:	e9 d0 02 00 00       	jmp    c010323a <__alltraps>

c0102f6a <vector196>:
.globl vector196
vector196:
  pushl $0
c0102f6a:	6a 00                	push   $0x0
  pushl $196
c0102f6c:	68 c4 00 00 00       	push   $0xc4
  jmp __alltraps
c0102f71:	e9 c4 02 00 00       	jmp    c010323a <__alltraps>

c0102f76 <vector197>:
.globl vector197
vector197:
  pushl $0
c0102f76:	6a 00                	push   $0x0
  pushl $197
c0102f78:	68 c5 00 00 00       	push   $0xc5
  jmp __alltraps
c0102f7d:	e9 b8 02 00 00       	jmp    c010323a <__alltraps>

c0102f82 <vector198>:
.globl vector198
vector198:
  pushl $0
c0102f82:	6a 00                	push   $0x0
  pushl $198
c0102f84:	68 c6 00 00 00       	push   $0xc6
  jmp __alltraps
c0102f89:	e9 ac 02 00 00       	jmp    c010323a <__alltraps>

c0102f8e <vector199>:
.globl vector199
vector199:
  pushl $0
c0102f8e:	6a 00                	push   $0x0
  pushl $199
c0102f90:	68 c7 00 00 00       	push   $0xc7
  jmp __alltraps
c0102f95:	e9 a0 02 00 00       	jmp    c010323a <__alltraps>

c0102f9a <vector200>:
.globl vector200
vector200:
  pushl $0
c0102f9a:	6a 00                	push   $0x0
  pushl $200
c0102f9c:	68 c8 00 00 00       	push   $0xc8
  jmp __alltraps
c0102fa1:	e9 94 02 00 00       	jmp    c010323a <__alltraps>

c0102fa6 <vector201>:
.globl vector201
vector201:
  pushl $0
c0102fa6:	6a 00                	push   $0x0
  pushl $201
c0102fa8:	68 c9 00 00 00       	push   $0xc9
  jmp __alltraps
c0102fad:	e9 88 02 00 00       	jmp    c010323a <__alltraps>

c0102fb2 <vector202>:
.globl vector202
vector202:
  pushl $0
c0102fb2:	6a 00                	push   $0x0
  pushl $202
c0102fb4:	68 ca 00 00 00       	push   $0xca
  jmp __alltraps
c0102fb9:	e9 7c 02 00 00       	jmp    c010323a <__alltraps>

c0102fbe <vector203>:
.globl vector203
vector203:
  pushl $0
c0102fbe:	6a 00                	push   $0x0
  pushl $203
c0102fc0:	68 cb 00 00 00       	push   $0xcb
  jmp __alltraps
c0102fc5:	e9 70 02 00 00       	jmp    c010323a <__alltraps>

c0102fca <vector204>:
.globl vector204
vector204:
  pushl $0
c0102fca:	6a 00                	push   $0x0
  pushl $204
c0102fcc:	68 cc 00 00 00       	push   $0xcc
  jmp __alltraps
c0102fd1:	e9 64 02 00 00       	jmp    c010323a <__alltraps>

c0102fd6 <vector205>:
.globl vector205
vector205:
  pushl $0
c0102fd6:	6a 00                	push   $0x0
  pushl $205
c0102fd8:	68 cd 00 00 00       	push   $0xcd
  jmp __alltraps
c0102fdd:	e9 58 02 00 00       	jmp    c010323a <__alltraps>

c0102fe2 <vector206>:
.globl vector206
vector206:
  pushl $0
c0102fe2:	6a 00                	push   $0x0
  pushl $206
c0102fe4:	68 ce 00 00 00       	push   $0xce
  jmp __alltraps
c0102fe9:	e9 4c 02 00 00       	jmp    c010323a <__alltraps>

c0102fee <vector207>:
.globl vector207
vector207:
  pushl $0
c0102fee:	6a 00                	push   $0x0
  pushl $207
c0102ff0:	68 cf 00 00 00       	push   $0xcf
  jmp __alltraps
c0102ff5:	e9 40 02 00 00       	jmp    c010323a <__alltraps>

c0102ffa <vector208>:
.globl vector208
vector208:
  pushl $0
c0102ffa:	6a 00                	push   $0x0
  pushl $208
c0102ffc:	68 d0 00 00 00       	push   $0xd0
  jmp __alltraps
c0103001:	e9 34 02 00 00       	jmp    c010323a <__alltraps>

c0103006 <vector209>:
.globl vector209
vector209:
  pushl $0
c0103006:	6a 00                	push   $0x0
  pushl $209
c0103008:	68 d1 00 00 00       	push   $0xd1
  jmp __alltraps
c010300d:	e9 28 02 00 00       	jmp    c010323a <__alltraps>

c0103012 <vector210>:
.globl vector210
vector210:
  pushl $0
c0103012:	6a 00                	push   $0x0
  pushl $210
c0103014:	68 d2 00 00 00       	push   $0xd2
  jmp __alltraps
c0103019:	e9 1c 02 00 00       	jmp    c010323a <__alltraps>

c010301e <vector211>:
.globl vector211
vector211:
  pushl $0
c010301e:	6a 00                	push   $0x0
  pushl $211
c0103020:	68 d3 00 00 00       	push   $0xd3
  jmp __alltraps
c0103025:	e9 10 02 00 00       	jmp    c010323a <__alltraps>

c010302a <vector212>:
.globl vector212
vector212:
  pushl $0
c010302a:	6a 00                	push   $0x0
  pushl $212
c010302c:	68 d4 00 00 00       	push   $0xd4
  jmp __alltraps
c0103031:	e9 04 02 00 00       	jmp    c010323a <__alltraps>

c0103036 <vector213>:
.globl vector213
vector213:
  pushl $0
c0103036:	6a 00                	push   $0x0
  pushl $213
c0103038:	68 d5 00 00 00       	push   $0xd5
  jmp __alltraps
c010303d:	e9 f8 01 00 00       	jmp    c010323a <__alltraps>

c0103042 <vector214>:
.globl vector214
vector214:
  pushl $0
c0103042:	6a 00                	push   $0x0
  pushl $214
c0103044:	68 d6 00 00 00       	push   $0xd6
  jmp __alltraps
c0103049:	e9 ec 01 00 00       	jmp    c010323a <__alltraps>

c010304e <vector215>:
.globl vector215
vector215:
  pushl $0
c010304e:	6a 00                	push   $0x0
  pushl $215
c0103050:	68 d7 00 00 00       	push   $0xd7
  jmp __alltraps
c0103055:	e9 e0 01 00 00       	jmp    c010323a <__alltraps>

c010305a <vector216>:
.globl vector216
vector216:
  pushl $0
c010305a:	6a 00                	push   $0x0
  pushl $216
c010305c:	68 d8 00 00 00       	push   $0xd8
  jmp __alltraps
c0103061:	e9 d4 01 00 00       	jmp    c010323a <__alltraps>

c0103066 <vector217>:
.globl vector217
vector217:
  pushl $0
c0103066:	6a 00                	push   $0x0
  pushl $217
c0103068:	68 d9 00 00 00       	push   $0xd9
  jmp __alltraps
c010306d:	e9 c8 01 00 00       	jmp    c010323a <__alltraps>

c0103072 <vector218>:
.globl vector218
vector218:
  pushl $0
c0103072:	6a 00                	push   $0x0
  pushl $218
c0103074:	68 da 00 00 00       	push   $0xda
  jmp __alltraps
c0103079:	e9 bc 01 00 00       	jmp    c010323a <__alltraps>

c010307e <vector219>:
.globl vector219
vector219:
  pushl $0
c010307e:	6a 00                	push   $0x0
  pushl $219
c0103080:	68 db 00 00 00       	push   $0xdb
  jmp __alltraps
c0103085:	e9 b0 01 00 00       	jmp    c010323a <__alltraps>

c010308a <vector220>:
.globl vector220
vector220:
  pushl $0
c010308a:	6a 00                	push   $0x0
  pushl $220
c010308c:	68 dc 00 00 00       	push   $0xdc
  jmp __alltraps
c0103091:	e9 a4 01 00 00       	jmp    c010323a <__alltraps>

c0103096 <vector221>:
.globl vector221
vector221:
  pushl $0
c0103096:	6a 00                	push   $0x0
  pushl $221
c0103098:	68 dd 00 00 00       	push   $0xdd
  jmp __alltraps
c010309d:	e9 98 01 00 00       	jmp    c010323a <__alltraps>

c01030a2 <vector222>:
.globl vector222
vector222:
  pushl $0
c01030a2:	6a 00                	push   $0x0
  pushl $222
c01030a4:	68 de 00 00 00       	push   $0xde
  jmp __alltraps
c01030a9:	e9 8c 01 00 00       	jmp    c010323a <__alltraps>

c01030ae <vector223>:
.globl vector223
vector223:
  pushl $0
c01030ae:	6a 00                	push   $0x0
  pushl $223
c01030b0:	68 df 00 00 00       	push   $0xdf
  jmp __alltraps
c01030b5:	e9 80 01 00 00       	jmp    c010323a <__alltraps>

c01030ba <vector224>:
.globl vector224
vector224:
  pushl $0
c01030ba:	6a 00                	push   $0x0
  pushl $224
c01030bc:	68 e0 00 00 00       	push   $0xe0
  jmp __alltraps
c01030c1:	e9 74 01 00 00       	jmp    c010323a <__alltraps>

c01030c6 <vector225>:
.globl vector225
vector225:
  pushl $0
c01030c6:	6a 00                	push   $0x0
  pushl $225
c01030c8:	68 e1 00 00 00       	push   $0xe1
  jmp __alltraps
c01030cd:	e9 68 01 00 00       	jmp    c010323a <__alltraps>

c01030d2 <vector226>:
.globl vector226
vector226:
  pushl $0
c01030d2:	6a 00                	push   $0x0
  pushl $226
c01030d4:	68 e2 00 00 00       	push   $0xe2
  jmp __alltraps
c01030d9:	e9 5c 01 00 00       	jmp    c010323a <__alltraps>

c01030de <vector227>:
.globl vector227
vector227:
  pushl $0
c01030de:	6a 00                	push   $0x0
  pushl $227
c01030e0:	68 e3 00 00 00       	push   $0xe3
  jmp __alltraps
c01030e5:	e9 50 01 00 00       	jmp    c010323a <__alltraps>

c01030ea <vector228>:
.globl vector228
vector228:
  pushl $0
c01030ea:	6a 00                	push   $0x0
  pushl $228
c01030ec:	68 e4 00 00 00       	push   $0xe4
  jmp __alltraps
c01030f1:	e9 44 01 00 00       	jmp    c010323a <__alltraps>

c01030f6 <vector229>:
.globl vector229
vector229:
  pushl $0
c01030f6:	6a 00                	push   $0x0
  pushl $229
c01030f8:	68 e5 00 00 00       	push   $0xe5
  jmp __alltraps
c01030fd:	e9 38 01 00 00       	jmp    c010323a <__alltraps>

c0103102 <vector230>:
.globl vector230
vector230:
  pushl $0
c0103102:	6a 00                	push   $0x0
  pushl $230
c0103104:	68 e6 00 00 00       	push   $0xe6
  jmp __alltraps
c0103109:	e9 2c 01 00 00       	jmp    c010323a <__alltraps>

c010310e <vector231>:
.globl vector231
vector231:
  pushl $0
c010310e:	6a 00                	push   $0x0
  pushl $231
c0103110:	68 e7 00 00 00       	push   $0xe7
  jmp __alltraps
c0103115:	e9 20 01 00 00       	jmp    c010323a <__alltraps>

c010311a <vector232>:
.globl vector232
vector232:
  pushl $0
c010311a:	6a 00                	push   $0x0
  pushl $232
c010311c:	68 e8 00 00 00       	push   $0xe8
  jmp __alltraps
c0103121:	e9 14 01 00 00       	jmp    c010323a <__alltraps>

c0103126 <vector233>:
.globl vector233
vector233:
  pushl $0
c0103126:	6a 00                	push   $0x0
  pushl $233
c0103128:	68 e9 00 00 00       	push   $0xe9
  jmp __alltraps
c010312d:	e9 08 01 00 00       	jmp    c010323a <__alltraps>

c0103132 <vector234>:
.globl vector234
vector234:
  pushl $0
c0103132:	6a 00                	push   $0x0
  pushl $234
c0103134:	68 ea 00 00 00       	push   $0xea
  jmp __alltraps
c0103139:	e9 fc 00 00 00       	jmp    c010323a <__alltraps>

c010313e <vector235>:
.globl vector235
vector235:
  pushl $0
c010313e:	6a 00                	push   $0x0
  pushl $235
c0103140:	68 eb 00 00 00       	push   $0xeb
  jmp __alltraps
c0103145:	e9 f0 00 00 00       	jmp    c010323a <__alltraps>

c010314a <vector236>:
.globl vector236
vector236:
  pushl $0
c010314a:	6a 00                	push   $0x0
  pushl $236
c010314c:	68 ec 00 00 00       	push   $0xec
  jmp __alltraps
c0103151:	e9 e4 00 00 00       	jmp    c010323a <__alltraps>

c0103156 <vector237>:
.globl vector237
vector237:
  pushl $0
c0103156:	6a 00                	push   $0x0
  pushl $237
c0103158:	68 ed 00 00 00       	push   $0xed
  jmp __alltraps
c010315d:	e9 d8 00 00 00       	jmp    c010323a <__alltraps>

c0103162 <vector238>:
.globl vector238
vector238:
  pushl $0
c0103162:	6a 00                	push   $0x0
  pushl $238
c0103164:	68 ee 00 00 00       	push   $0xee
  jmp __alltraps
c0103169:	e9 cc 00 00 00       	jmp    c010323a <__alltraps>

c010316e <vector239>:
.globl vector239
vector239:
  pushl $0
c010316e:	6a 00                	push   $0x0
  pushl $239
c0103170:	68 ef 00 00 00       	push   $0xef
  jmp __alltraps
c0103175:	e9 c0 00 00 00       	jmp    c010323a <__alltraps>

c010317a <vector240>:
.globl vector240
vector240:
  pushl $0
c010317a:	6a 00                	push   $0x0
  pushl $240
c010317c:	68 f0 00 00 00       	push   $0xf0
  jmp __alltraps
c0103181:	e9 b4 00 00 00       	jmp    c010323a <__alltraps>

c0103186 <vector241>:
.globl vector241
vector241:
  pushl $0
c0103186:	6a 00                	push   $0x0
  pushl $241
c0103188:	68 f1 00 00 00       	push   $0xf1
  jmp __alltraps
c010318d:	e9 a8 00 00 00       	jmp    c010323a <__alltraps>

c0103192 <vector242>:
.globl vector242
vector242:
  pushl $0
c0103192:	6a 00                	push   $0x0
  pushl $242
c0103194:	68 f2 00 00 00       	push   $0xf2
  jmp __alltraps
c0103199:	e9 9c 00 00 00       	jmp    c010323a <__alltraps>

c010319e <vector243>:
.globl vector243
vector243:
  pushl $0
c010319e:	6a 00                	push   $0x0
  pushl $243
c01031a0:	68 f3 00 00 00       	push   $0xf3
  jmp __alltraps
c01031a5:	e9 90 00 00 00       	jmp    c010323a <__alltraps>

c01031aa <vector244>:
.globl vector244
vector244:
  pushl $0
c01031aa:	6a 00                	push   $0x0
  pushl $244
c01031ac:	68 f4 00 00 00       	push   $0xf4
  jmp __alltraps
c01031b1:	e9 84 00 00 00       	jmp    c010323a <__alltraps>

c01031b6 <vector245>:
.globl vector245
vector245:
  pushl $0
c01031b6:	6a 00                	push   $0x0
  pushl $245
c01031b8:	68 f5 00 00 00       	push   $0xf5
  jmp __alltraps
c01031bd:	e9 78 00 00 00       	jmp    c010323a <__alltraps>

c01031c2 <vector246>:
.globl vector246
vector246:
  pushl $0
c01031c2:	6a 00                	push   $0x0
  pushl $246
c01031c4:	68 f6 00 00 00       	push   $0xf6
  jmp __alltraps
c01031c9:	e9 6c 00 00 00       	jmp    c010323a <__alltraps>

c01031ce <vector247>:
.globl vector247
vector247:
  pushl $0
c01031ce:	6a 00                	push   $0x0
  pushl $247
c01031d0:	68 f7 00 00 00       	push   $0xf7
  jmp __alltraps
c01031d5:	e9 60 00 00 00       	jmp    c010323a <__alltraps>

c01031da <vector248>:
.globl vector248
vector248:
  pushl $0
c01031da:	6a 00                	push   $0x0
  pushl $248
c01031dc:	68 f8 00 00 00       	push   $0xf8
  jmp __alltraps
c01031e1:	e9 54 00 00 00       	jmp    c010323a <__alltraps>

c01031e6 <vector249>:
.globl vector249
vector249:
  pushl $0
c01031e6:	6a 00                	push   $0x0
  pushl $249
c01031e8:	68 f9 00 00 00       	push   $0xf9
  jmp __alltraps
c01031ed:	e9 48 00 00 00       	jmp    c010323a <__alltraps>

c01031f2 <vector250>:
.globl vector250
vector250:
  pushl $0
c01031f2:	6a 00                	push   $0x0
  pushl $250
c01031f4:	68 fa 00 00 00       	push   $0xfa
  jmp __alltraps
c01031f9:	e9 3c 00 00 00       	jmp    c010323a <__alltraps>

c01031fe <vector251>:
.globl vector251
vector251:
  pushl $0
c01031fe:	6a 00                	push   $0x0
  pushl $251
c0103200:	68 fb 00 00 00       	push   $0xfb
  jmp __alltraps
c0103205:	e9 30 00 00 00       	jmp    c010323a <__alltraps>

c010320a <vector252>:
.globl vector252
vector252:
  pushl $0
c010320a:	6a 00                	push   $0x0
  pushl $252
c010320c:	68 fc 00 00 00       	push   $0xfc
  jmp __alltraps
c0103211:	e9 24 00 00 00       	jmp    c010323a <__alltraps>

c0103216 <vector253>:
.globl vector253
vector253:
  pushl $0
c0103216:	6a 00                	push   $0x0
  pushl $253
c0103218:	68 fd 00 00 00       	push   $0xfd
  jmp __alltraps
c010321d:	e9 18 00 00 00       	jmp    c010323a <__alltraps>

c0103222 <vector254>:
.globl vector254
vector254:
  pushl $0
c0103222:	6a 00                	push   $0x0
  pushl $254
c0103224:	68 fe 00 00 00       	push   $0xfe
  jmp __alltraps
c0103229:	e9 0c 00 00 00       	jmp    c010323a <__alltraps>

c010322e <vector255>:
.globl vector255
vector255:
  pushl $0
c010322e:	6a 00                	push   $0x0
  pushl $255
c0103230:	68 ff 00 00 00       	push   $0xff
  jmp __alltraps
c0103235:	e9 00 00 00 00       	jmp    c010323a <__alltraps>

c010323a <__alltraps>:
.text
.globl __alltraps
__alltraps:
    # push registers to build a trap frame
    # therefore make the stack look like a struct trapframe
    pushl %ds
c010323a:	1e                   	push   %ds
    pushl %es
c010323b:	06                   	push   %es
    pushl %fs
c010323c:	0f a0                	push   %fs
    pushl %gs
c010323e:	0f a8                	push   %gs
    pushal
c0103240:	60                   	pusha  

    # load GD_KDATA into %ds and %es to set up data segments for kernel
    movl $GD_KDATA, %eax
c0103241:	b8 10 00 00 00       	mov    $0x10,%eax
    movw %ax, %ds
c0103246:	8e d8                	mov    %eax,%ds
    movw %ax, %es
c0103248:	8e c0                	mov    %eax,%es

    # push %esp to pass a pointer to the trapframe as an argument to trap()
    pushl %esp
c010324a:	54                   	push   %esp

    # call trap(tf), where tf=%esp
    call trap
c010324b:	e8 60 f5 ff ff       	call   c01027b0 <trap>

    # pop the pushed stack pointer
    popl %esp
c0103250:	5c                   	pop    %esp

c0103251 <__trapret>:

    # return falls through to trapret...
.globl __trapret
__trapret:                            #恢复被中断的一个过程
    # restore registers from stack
    popal
c0103251:	61                   	popa   

    # restore %ds, %es, %fs and %gs
    popl %gs
c0103252:	0f a9                	pop    %gs
    popl %fs
c0103254:	0f a1                	pop    %fs
    popl %es
c0103256:	07                   	pop    %es
    popl %ds
c0103257:	1f                   	pop    %ds

    # get rid of the trap number and error code
    addl $0x8, %esp
c0103258:	83 c4 08             	add    $0x8,%esp
    iret
c010325b:	cf                   	iret   

c010325c <forkrets>:

.globl forkrets
forkrets:
    # set stack to this new process's trapframe
    movl 4(%esp), %esp   #把esp指向当前进程的中断帧
c010325c:	8b 64 24 04          	mov    0x4(%esp),%esp
    jmp __trapret
c0103260:	eb ef                	jmp    c0103251 <__trapret>

c0103262 <pa2page>:
page2pa(struct Page *page) {
    return page2ppn(page) << PGSHIFT;
}

static inline struct Page *
pa2page(uintptr_t pa) {
c0103262:	55                   	push   %ebp
c0103263:	89 e5                	mov    %esp,%ebp
c0103265:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0103268:	8b 45 08             	mov    0x8(%ebp),%eax
c010326b:	c1 e8 0c             	shr    $0xc,%eax
c010326e:	89 c2                	mov    %eax,%edx
c0103270:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0103275:	39 c2                	cmp    %eax,%edx
c0103277:	72 1c                	jb     c0103295 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0103279:	c7 44 24 08 90 a9 10 	movl   $0xc010a990,0x8(%esp)
c0103280:	c0 
c0103281:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0103288:	00 
c0103289:	c7 04 24 af a9 10 c0 	movl   $0xc010a9af,(%esp)
c0103290:	e8 a8 d1 ff ff       	call   c010043d <__panic>
    }
    return &pages[PPN(pa)];
c0103295:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c010329a:	8b 55 08             	mov    0x8(%ebp),%edx
c010329d:	c1 ea 0c             	shr    $0xc,%edx
c01032a0:	c1 e2 05             	shl    $0x5,%edx
c01032a3:	01 d0                	add    %edx,%eax
}
c01032a5:	c9                   	leave  
c01032a6:	c3                   	ret    

c01032a7 <pde2page>:
    }
    return pa2page(PTE_ADDR(pte));
}

static inline struct Page *
pde2page(pde_t pde) {
c01032a7:	55                   	push   %ebp
c01032a8:	89 e5                	mov    %esp,%ebp
c01032aa:	83 ec 18             	sub    $0x18,%esp
    return pa2page(PDE_ADDR(pde));
c01032ad:	8b 45 08             	mov    0x8(%ebp),%eax
c01032b0:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01032b5:	89 04 24             	mov    %eax,(%esp)
c01032b8:	e8 a5 ff ff ff       	call   c0103262 <pa2page>
}
c01032bd:	c9                   	leave  
c01032be:	c3                   	ret    

c01032bf <mm_create>:
static void check_vma_struct(void);
static void check_pgfault(void);

// mm_create -  alloc a mm_struct & initialize it.
struct mm_struct *
mm_create(void) {
c01032bf:	f3 0f 1e fb          	endbr32 
c01032c3:	55                   	push   %ebp
c01032c4:	89 e5                	mov    %esp,%ebp
c01032c6:	83 ec 28             	sub    $0x28,%esp
    struct mm_struct *mm = kmalloc(sizeof(struct mm_struct));
c01032c9:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c01032d0:	e8 26 1f 00 00       	call   c01051fb <kmalloc>
c01032d5:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (mm != NULL) {
c01032d8:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01032dc:	74 59                	je     c0103337 <mm_create+0x78>
        list_init(&(mm->mmap_list));
c01032de:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01032e1:	89 45 f0             	mov    %eax,-0x10(%ebp)
 * list_init - initialize a new entry
 * @elm:        new entry to be initialized
 * */
static inline void
list_init(list_entry_t *elm) {
    elm->prev = elm->next = elm;
c01032e4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01032e7:	8b 55 f0             	mov    -0x10(%ebp),%edx
c01032ea:	89 50 04             	mov    %edx,0x4(%eax)
c01032ed:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01032f0:	8b 50 04             	mov    0x4(%eax),%edx
c01032f3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01032f6:	89 10                	mov    %edx,(%eax)
}
c01032f8:	90                   	nop
        mm->mmap_cache = NULL;
c01032f9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01032fc:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        mm->pgdir = NULL;
c0103303:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103306:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        mm->map_count = 0;
c010330d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103310:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)

        if (swap_init_ok) swap_init_mm(mm);
c0103317:	a1 68 bf 12 c0       	mov    0xc012bf68,%eax
c010331c:	85 c0                	test   %eax,%eax
c010331e:	74 0d                	je     c010332d <mm_create+0x6e>
c0103320:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103323:	89 04 24             	mov    %eax,(%esp)
c0103326:	e8 a3 0d 00 00       	call   c01040ce <swap_init_mm>
c010332b:	eb 0a                	jmp    c0103337 <mm_create+0x78>
        else mm->sm_priv = NULL;
c010332d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103330:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
    }
    return mm;
c0103337:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010333a:	c9                   	leave  
c010333b:	c3                   	ret    

c010333c <vma_create>:

// vma_create - alloc a vma_struct & initialize it. (addr range: vm_start~vm_end)
struct vma_struct *
vma_create(uintptr_t vm_start, uintptr_t vm_end, uint32_t vm_flags) {
c010333c:	f3 0f 1e fb          	endbr32 
c0103340:	55                   	push   %ebp
c0103341:	89 e5                	mov    %esp,%ebp
c0103343:	83 ec 28             	sub    $0x28,%esp
    struct vma_struct *vma = kmalloc(sizeof(struct vma_struct));
c0103346:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
c010334d:	e8 a9 1e 00 00       	call   c01051fb <kmalloc>
c0103352:	89 45 f4             	mov    %eax,-0xc(%ebp)

    if (vma != NULL) {
c0103355:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103359:	74 1b                	je     c0103376 <vma_create+0x3a>
        vma->vm_start = vm_start;
c010335b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010335e:	8b 55 08             	mov    0x8(%ebp),%edx
c0103361:	89 50 04             	mov    %edx,0x4(%eax)
        vma->vm_end = vm_end;
c0103364:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103367:	8b 55 0c             	mov    0xc(%ebp),%edx
c010336a:	89 50 08             	mov    %edx,0x8(%eax)
        vma->vm_flags = vm_flags;
c010336d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103370:	8b 55 10             	mov    0x10(%ebp),%edx
c0103373:	89 50 0c             	mov    %edx,0xc(%eax)
    }
    return vma;
c0103376:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0103379:	c9                   	leave  
c010337a:	c3                   	ret    

c010337b <find_vma>:


// find_vma - find a vma  (vma->vm_start <= addr <= vma_vm_end)
struct vma_struct *
find_vma(struct mm_struct *mm, uintptr_t addr) {
c010337b:	f3 0f 1e fb          	endbr32 
c010337f:	55                   	push   %ebp
c0103380:	89 e5                	mov    %esp,%ebp
c0103382:	83 ec 20             	sub    $0x20,%esp
    struct vma_struct *vma = NULL;
c0103385:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    if (mm != NULL) {
c010338c:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0103390:	0f 84 95 00 00 00    	je     c010342b <find_vma+0xb0>
        vma = mm->mmap_cache;
c0103396:	8b 45 08             	mov    0x8(%ebp),%eax
c0103399:	8b 40 08             	mov    0x8(%eax),%eax
c010339c:	89 45 fc             	mov    %eax,-0x4(%ebp)
        if (!(vma != NULL && vma->vm_start <= addr && vma->vm_end > addr)) {
c010339f:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c01033a3:	74 16                	je     c01033bb <find_vma+0x40>
c01033a5:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01033a8:	8b 40 04             	mov    0x4(%eax),%eax
c01033ab:	39 45 0c             	cmp    %eax,0xc(%ebp)
c01033ae:	72 0b                	jb     c01033bb <find_vma+0x40>
c01033b0:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01033b3:	8b 40 08             	mov    0x8(%eax),%eax
c01033b6:	39 45 0c             	cmp    %eax,0xc(%ebp)
c01033b9:	72 61                	jb     c010341c <find_vma+0xa1>
                bool found = 0;
c01033bb:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
                list_entry_t *list = &(mm->mmap_list), *le = list;
c01033c2:	8b 45 08             	mov    0x8(%ebp),%eax
c01033c5:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01033c8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01033cb:	89 45 f4             	mov    %eax,-0xc(%ebp)
                while ((le = list_next(le)) != list) {
c01033ce:	eb 28                	jmp    c01033f8 <find_vma+0x7d>
                    vma = le2vma(le, list_link);
c01033d0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01033d3:	83 e8 10             	sub    $0x10,%eax
c01033d6:	89 45 fc             	mov    %eax,-0x4(%ebp)
                    if (vma->vm_start<=addr && addr < vma->vm_end) {
c01033d9:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01033dc:	8b 40 04             	mov    0x4(%eax),%eax
c01033df:	39 45 0c             	cmp    %eax,0xc(%ebp)
c01033e2:	72 14                	jb     c01033f8 <find_vma+0x7d>
c01033e4:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01033e7:	8b 40 08             	mov    0x8(%eax),%eax
c01033ea:	39 45 0c             	cmp    %eax,0xc(%ebp)
c01033ed:	73 09                	jae    c01033f8 <find_vma+0x7d>
                        found = 1;
c01033ef:	c7 45 f8 01 00 00 00 	movl   $0x1,-0x8(%ebp)
                        break;
c01033f6:	eb 17                	jmp    c010340f <find_vma+0x94>
c01033f8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01033fb:	89 45 ec             	mov    %eax,-0x14(%ebp)
 * list_next - get the next entry
 * @listelm:    the list head
 **/
static inline list_entry_t *
list_next(list_entry_t *listelm) {
    return listelm->next;
c01033fe:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103401:	8b 40 04             	mov    0x4(%eax),%eax
                while ((le = list_next(le)) != list) {
c0103404:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103407:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010340a:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c010340d:	75 c1                	jne    c01033d0 <find_vma+0x55>
                    }
                }
                if (!found) {
c010340f:	83 7d f8 00          	cmpl   $0x0,-0x8(%ebp)
c0103413:	75 07                	jne    c010341c <find_vma+0xa1>
                    vma = NULL;
c0103415:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
                }
        }
        if (vma != NULL) {
c010341c:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c0103420:	74 09                	je     c010342b <find_vma+0xb0>
            mm->mmap_cache = vma;
c0103422:	8b 45 08             	mov    0x8(%ebp),%eax
c0103425:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0103428:	89 50 08             	mov    %edx,0x8(%eax)
        }
    }
    return vma;
c010342b:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c010342e:	c9                   	leave  
c010342f:	c3                   	ret    

c0103430 <check_vma_overlap>:


// check_vma_overlap - check if vma1 overlaps vma2 ?
static inline void
check_vma_overlap(struct vma_struct *prev, struct vma_struct *next) {
c0103430:	55                   	push   %ebp
c0103431:	89 e5                	mov    %esp,%ebp
c0103433:	83 ec 18             	sub    $0x18,%esp
    assert(prev->vm_start < prev->vm_end);
c0103436:	8b 45 08             	mov    0x8(%ebp),%eax
c0103439:	8b 50 04             	mov    0x4(%eax),%edx
c010343c:	8b 45 08             	mov    0x8(%ebp),%eax
c010343f:	8b 40 08             	mov    0x8(%eax),%eax
c0103442:	39 c2                	cmp    %eax,%edx
c0103444:	72 24                	jb     c010346a <check_vma_overlap+0x3a>
c0103446:	c7 44 24 0c bd a9 10 	movl   $0xc010a9bd,0xc(%esp)
c010344d:	c0 
c010344e:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103455:	c0 
c0103456:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
c010345d:	00 
c010345e:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103465:	e8 d3 cf ff ff       	call   c010043d <__panic>
    assert(prev->vm_end <= next->vm_start);
c010346a:	8b 45 08             	mov    0x8(%ebp),%eax
c010346d:	8b 50 08             	mov    0x8(%eax),%edx
c0103470:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103473:	8b 40 04             	mov    0x4(%eax),%eax
c0103476:	39 c2                	cmp    %eax,%edx
c0103478:	76 24                	jbe    c010349e <check_vma_overlap+0x6e>
c010347a:	c7 44 24 0c 00 aa 10 	movl   $0xc010aa00,0xc(%esp)
c0103481:	c0 
c0103482:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103489:	c0 
c010348a:	c7 44 24 04 69 00 00 	movl   $0x69,0x4(%esp)
c0103491:	00 
c0103492:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103499:	e8 9f cf ff ff       	call   c010043d <__panic>
    assert(next->vm_start < next->vm_end);
c010349e:	8b 45 0c             	mov    0xc(%ebp),%eax
c01034a1:	8b 50 04             	mov    0x4(%eax),%edx
c01034a4:	8b 45 0c             	mov    0xc(%ebp),%eax
c01034a7:	8b 40 08             	mov    0x8(%eax),%eax
c01034aa:	39 c2                	cmp    %eax,%edx
c01034ac:	72 24                	jb     c01034d2 <check_vma_overlap+0xa2>
c01034ae:	c7 44 24 0c 1f aa 10 	movl   $0xc010aa1f,0xc(%esp)
c01034b5:	c0 
c01034b6:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c01034bd:	c0 
c01034be:	c7 44 24 04 6a 00 00 	movl   $0x6a,0x4(%esp)
c01034c5:	00 
c01034c6:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c01034cd:	e8 6b cf ff ff       	call   c010043d <__panic>
}
c01034d2:	90                   	nop
c01034d3:	c9                   	leave  
c01034d4:	c3                   	ret    

c01034d5 <insert_vma_struct>:


// insert_vma_struct -insert vma in mm's list link
void
insert_vma_struct(struct mm_struct *mm, struct vma_struct *vma) {
c01034d5:	f3 0f 1e fb          	endbr32 
c01034d9:	55                   	push   %ebp
c01034da:	89 e5                	mov    %esp,%ebp
c01034dc:	83 ec 48             	sub    $0x48,%esp
    assert(vma->vm_start < vma->vm_end);
c01034df:	8b 45 0c             	mov    0xc(%ebp),%eax
c01034e2:	8b 50 04             	mov    0x4(%eax),%edx
c01034e5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01034e8:	8b 40 08             	mov    0x8(%eax),%eax
c01034eb:	39 c2                	cmp    %eax,%edx
c01034ed:	72 24                	jb     c0103513 <insert_vma_struct+0x3e>
c01034ef:	c7 44 24 0c 3d aa 10 	movl   $0xc010aa3d,0xc(%esp)
c01034f6:	c0 
c01034f7:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c01034fe:	c0 
c01034ff:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c0103506:	00 
c0103507:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c010350e:	e8 2a cf ff ff       	call   c010043d <__panic>
    list_entry_t *list = &(mm->mmap_list);
c0103513:	8b 45 08             	mov    0x8(%ebp),%eax
c0103516:	89 45 ec             	mov    %eax,-0x14(%ebp)
    list_entry_t *le_prev = list, *le_next;
c0103519:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010351c:	89 45 f4             	mov    %eax,-0xc(%ebp)

        list_entry_t *le = list;
c010351f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103522:	89 45 f0             	mov    %eax,-0x10(%ebp)
        while ((le = list_next(le)) != list) {
c0103525:	eb 1f                	jmp    c0103546 <insert_vma_struct+0x71>
            struct vma_struct *mmap_prev = le2vma(le, list_link);
c0103527:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010352a:	83 e8 10             	sub    $0x10,%eax
c010352d:	89 45 e8             	mov    %eax,-0x18(%ebp)
            if (mmap_prev->vm_start > vma->vm_start) {
c0103530:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103533:	8b 50 04             	mov    0x4(%eax),%edx
c0103536:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103539:	8b 40 04             	mov    0x4(%eax),%eax
c010353c:	39 c2                	cmp    %eax,%edx
c010353e:	77 1f                	ja     c010355f <insert_vma_struct+0x8a>
                break;
            }
            le_prev = le;
c0103540:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103543:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103546:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103549:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010354c:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010354f:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c0103552:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103555:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103558:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010355b:	75 ca                	jne    c0103527 <insert_vma_struct+0x52>
c010355d:	eb 01                	jmp    c0103560 <insert_vma_struct+0x8b>
                break;
c010355f:	90                   	nop
c0103560:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103563:	89 45 dc             	mov    %eax,-0x24(%ebp)
c0103566:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103569:	8b 40 04             	mov    0x4(%eax),%eax
        }

    le_next = list_next(le_prev);
c010356c:	89 45 e4             	mov    %eax,-0x1c(%ebp)

    /* check overlap */
    if (le_prev != list) {
c010356f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103572:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0103575:	74 15                	je     c010358c <insert_vma_struct+0xb7>
        check_vma_overlap(le2vma(le_prev, list_link), vma);
c0103577:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010357a:	8d 50 f0             	lea    -0x10(%eax),%edx
c010357d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103580:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103584:	89 14 24             	mov    %edx,(%esp)
c0103587:	e8 a4 fe ff ff       	call   c0103430 <check_vma_overlap>
    }
    if (le_next != list) {
c010358c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010358f:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c0103592:	74 15                	je     c01035a9 <insert_vma_struct+0xd4>
        check_vma_overlap(vma, le2vma(le_next, list_link));
c0103594:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103597:	83 e8 10             	sub    $0x10,%eax
c010359a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010359e:	8b 45 0c             	mov    0xc(%ebp),%eax
c01035a1:	89 04 24             	mov    %eax,(%esp)
c01035a4:	e8 87 fe ff ff       	call   c0103430 <check_vma_overlap>
    }

    vma->vm_mm = mm;
c01035a9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01035ac:	8b 55 08             	mov    0x8(%ebp),%edx
c01035af:	89 10                	mov    %edx,(%eax)
    list_add_after(le_prev, &(vma->list_link));
c01035b1:	8b 45 0c             	mov    0xc(%ebp),%eax
c01035b4:	8d 50 10             	lea    0x10(%eax),%edx
c01035b7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01035ba:	89 45 d8             	mov    %eax,-0x28(%ebp)
c01035bd:	89 55 d4             	mov    %edx,-0x2c(%ebp)
    __list_add(elm, listelm, listelm->next);
c01035c0:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01035c3:	8b 40 04             	mov    0x4(%eax),%eax
c01035c6:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01035c9:	89 55 d0             	mov    %edx,-0x30(%ebp)
c01035cc:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01035cf:	89 55 cc             	mov    %edx,-0x34(%ebp)
c01035d2:	89 45 c8             	mov    %eax,-0x38(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_add(list_entry_t *elm, list_entry_t *prev, list_entry_t *next) {
    prev->next = next->prev = elm;
c01035d5:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01035d8:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01035db:	89 10                	mov    %edx,(%eax)
c01035dd:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01035e0:	8b 10                	mov    (%eax),%edx
c01035e2:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01035e5:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c01035e8:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01035eb:	8b 55 c8             	mov    -0x38(%ebp),%edx
c01035ee:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c01035f1:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01035f4:	8b 55 cc             	mov    -0x34(%ebp),%edx
c01035f7:	89 10                	mov    %edx,(%eax)
}
c01035f9:	90                   	nop
}
c01035fa:	90                   	nop

    mm->map_count ++;
c01035fb:	8b 45 08             	mov    0x8(%ebp),%eax
c01035fe:	8b 40 10             	mov    0x10(%eax),%eax
c0103601:	8d 50 01             	lea    0x1(%eax),%edx
c0103604:	8b 45 08             	mov    0x8(%ebp),%eax
c0103607:	89 50 10             	mov    %edx,0x10(%eax)
}
c010360a:	90                   	nop
c010360b:	c9                   	leave  
c010360c:	c3                   	ret    

c010360d <mm_destroy>:

// mm_destroy - free mm and mm internal fields
void
mm_destroy(struct mm_struct *mm) {
c010360d:	f3 0f 1e fb          	endbr32 
c0103611:	55                   	push   %ebp
c0103612:	89 e5                	mov    %esp,%ebp
c0103614:	83 ec 38             	sub    $0x38,%esp

    list_entry_t *list = &(mm->mmap_list), *le;
c0103617:	8b 45 08             	mov    0x8(%ebp),%eax
c010361a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    while ((le = list_next(list)) != list) {
c010361d:	eb 38                	jmp    c0103657 <mm_destroy+0x4a>
c010361f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103622:	89 45 ec             	mov    %eax,-0x14(%ebp)
    __list_del(listelm->prev, listelm->next);
c0103625:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103628:	8b 40 04             	mov    0x4(%eax),%eax
c010362b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010362e:	8b 12                	mov    (%edx),%edx
c0103630:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0103633:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 * */
static inline void
__list_del(list_entry_t *prev, list_entry_t *next) {
    prev->next = next;
c0103636:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103639:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010363c:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c010363f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103642:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0103645:	89 10                	mov    %edx,(%eax)
}
c0103647:	90                   	nop
}
c0103648:	90                   	nop
        list_del(le);
        kfree(le2vma(le, list_link));  //kfree vma        
c0103649:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010364c:	83 e8 10             	sub    $0x10,%eax
c010364f:	89 04 24             	mov    %eax,(%esp)
c0103652:	e8 c3 1b 00 00       	call   c010521a <kfree>
c0103657:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010365a:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return listelm->next;
c010365d:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103660:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(list)) != list) {
c0103663:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0103666:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103669:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010366c:	75 b1                	jne    c010361f <mm_destroy+0x12>
    }
    kfree(mm); //kfree mm
c010366e:	8b 45 08             	mov    0x8(%ebp),%eax
c0103671:	89 04 24             	mov    %eax,(%esp)
c0103674:	e8 a1 1b 00 00       	call   c010521a <kfree>
    mm=NULL;
c0103679:	c7 45 08 00 00 00 00 	movl   $0x0,0x8(%ebp)
}
c0103680:	90                   	nop
c0103681:	c9                   	leave  
c0103682:	c3                   	ret    

c0103683 <vmm_init>:

// vmm_init - initialize virtual memory management
//          - now just call check_vmm to check correctness of vmm
void
vmm_init(void) {
c0103683:	f3 0f 1e fb          	endbr32 
c0103687:	55                   	push   %ebp
c0103688:	89 e5                	mov    %esp,%ebp
c010368a:	83 ec 08             	sub    $0x8,%esp
    check_vmm();
c010368d:	e8 03 00 00 00       	call   c0103695 <check_vmm>
}
c0103692:	90                   	nop
c0103693:	c9                   	leave  
c0103694:	c3                   	ret    

c0103695 <check_vmm>:

// check_vmm - check correctness of vmm
static void
check_vmm(void) {
c0103695:	f3 0f 1e fb          	endbr32 
c0103699:	55                   	push   %ebp
c010369a:	89 e5                	mov    %esp,%ebp
c010369c:	83 ec 28             	sub    $0x28,%esp
    size_t nr_free_pages_store = nr_free_pages();
c010369f:	e8 00 38 00 00       	call   c0106ea4 <nr_free_pages>
c01036a4:	89 45 f4             	mov    %eax,-0xc(%ebp)
    
    check_vma_struct();
c01036a7:	e8 14 00 00 00       	call   c01036c0 <check_vma_struct>
    check_pgfault();
c01036ac:	e8 a5 04 00 00       	call   c0103b56 <check_pgfault>

 //   assert(nr_free_pages_store == nr_free_pages());

    cprintf("check_vmm() succeeded.\n");
c01036b1:	c7 04 24 59 aa 10 c0 	movl   $0xc010aa59,(%esp)
c01036b8:	e8 14 cc ff ff       	call   c01002d1 <cprintf>
}
c01036bd:	90                   	nop
c01036be:	c9                   	leave  
c01036bf:	c3                   	ret    

c01036c0 <check_vma_struct>:

static void
check_vma_struct(void) {
c01036c0:	f3 0f 1e fb          	endbr32 
c01036c4:	55                   	push   %ebp
c01036c5:	89 e5                	mov    %esp,%ebp
c01036c7:	83 ec 68             	sub    $0x68,%esp
    size_t nr_free_pages_store = nr_free_pages();
c01036ca:	e8 d5 37 00 00       	call   c0106ea4 <nr_free_pages>
c01036cf:	89 45 ec             	mov    %eax,-0x14(%ebp)

    struct mm_struct *mm = mm_create();
c01036d2:	e8 e8 fb ff ff       	call   c01032bf <mm_create>
c01036d7:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(mm != NULL);
c01036da:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c01036de:	75 24                	jne    c0103704 <check_vma_struct+0x44>
c01036e0:	c7 44 24 0c 71 aa 10 	movl   $0xc010aa71,0xc(%esp)
c01036e7:	c0 
c01036e8:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c01036ef:	c0 
c01036f0:	c7 44 24 04 b4 00 00 	movl   $0xb4,0x4(%esp)
c01036f7:	00 
c01036f8:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c01036ff:	e8 39 cd ff ff       	call   c010043d <__panic>

    int step1 = 10, step2 = step1 * 10;
c0103704:	c7 45 e4 0a 00 00 00 	movl   $0xa,-0x1c(%ebp)
c010370b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010370e:	89 d0                	mov    %edx,%eax
c0103710:	c1 e0 02             	shl    $0x2,%eax
c0103713:	01 d0                	add    %edx,%eax
c0103715:	01 c0                	add    %eax,%eax
c0103717:	89 45 e0             	mov    %eax,-0x20(%ebp)

    int i;
    for (i = step1; i >= 1; i --) {
c010371a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010371d:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103720:	eb 6f                	jmp    c0103791 <check_vma_struct+0xd1>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c0103722:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103725:	89 d0                	mov    %edx,%eax
c0103727:	c1 e0 02             	shl    $0x2,%eax
c010372a:	01 d0                	add    %edx,%eax
c010372c:	83 c0 02             	add    $0x2,%eax
c010372f:	89 c1                	mov    %eax,%ecx
c0103731:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103734:	89 d0                	mov    %edx,%eax
c0103736:	c1 e0 02             	shl    $0x2,%eax
c0103739:	01 d0                	add    %edx,%eax
c010373b:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0103742:	00 
c0103743:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0103747:	89 04 24             	mov    %eax,(%esp)
c010374a:	e8 ed fb ff ff       	call   c010333c <vma_create>
c010374f:	89 45 bc             	mov    %eax,-0x44(%ebp)
        assert(vma != NULL);
c0103752:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c0103756:	75 24                	jne    c010377c <check_vma_struct+0xbc>
c0103758:	c7 44 24 0c 7c aa 10 	movl   $0xc010aa7c,0xc(%esp)
c010375f:	c0 
c0103760:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103767:	c0 
c0103768:	c7 44 24 04 bb 00 00 	movl   $0xbb,0x4(%esp)
c010376f:	00 
c0103770:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103777:	e8 c1 cc ff ff       	call   c010043d <__panic>
        insert_vma_struct(mm, vma);
c010377c:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010377f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103783:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103786:	89 04 24             	mov    %eax,(%esp)
c0103789:	e8 47 fd ff ff       	call   c01034d5 <insert_vma_struct>
    for (i = step1; i >= 1; i --) {
c010378e:	ff 4d f4             	decl   -0xc(%ebp)
c0103791:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103795:	7f 8b                	jg     c0103722 <check_vma_struct+0x62>
    }

    for (i = step1 + 1; i <= step2; i ++) {
c0103797:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010379a:	40                   	inc    %eax
c010379b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010379e:	eb 6f                	jmp    c010380f <check_vma_struct+0x14f>
        struct vma_struct *vma = vma_create(i * 5, i * 5 + 2, 0);
c01037a0:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01037a3:	89 d0                	mov    %edx,%eax
c01037a5:	c1 e0 02             	shl    $0x2,%eax
c01037a8:	01 d0                	add    %edx,%eax
c01037aa:	83 c0 02             	add    $0x2,%eax
c01037ad:	89 c1                	mov    %eax,%ecx
c01037af:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01037b2:	89 d0                	mov    %edx,%eax
c01037b4:	c1 e0 02             	shl    $0x2,%eax
c01037b7:	01 d0                	add    %edx,%eax
c01037b9:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01037c0:	00 
c01037c1:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c01037c5:	89 04 24             	mov    %eax,(%esp)
c01037c8:	e8 6f fb ff ff       	call   c010333c <vma_create>
c01037cd:	89 45 c0             	mov    %eax,-0x40(%ebp)
        assert(vma != NULL);
c01037d0:	83 7d c0 00          	cmpl   $0x0,-0x40(%ebp)
c01037d4:	75 24                	jne    c01037fa <check_vma_struct+0x13a>
c01037d6:	c7 44 24 0c 7c aa 10 	movl   $0xc010aa7c,0xc(%esp)
c01037dd:	c0 
c01037de:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c01037e5:	c0 
c01037e6:	c7 44 24 04 c1 00 00 	movl   $0xc1,0x4(%esp)
c01037ed:	00 
c01037ee:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c01037f5:	e8 43 cc ff ff       	call   c010043d <__panic>
        insert_vma_struct(mm, vma);
c01037fa:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01037fd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103801:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103804:	89 04 24             	mov    %eax,(%esp)
c0103807:	e8 c9 fc ff ff       	call   c01034d5 <insert_vma_struct>
    for (i = step1 + 1; i <= step2; i ++) {
c010380c:	ff 45 f4             	incl   -0xc(%ebp)
c010380f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103812:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c0103815:	7e 89                	jle    c01037a0 <check_vma_struct+0xe0>
    }

    list_entry_t *le = list_next(&(mm->mmap_list));
c0103817:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010381a:	89 45 b8             	mov    %eax,-0x48(%ebp)
c010381d:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0103820:	8b 40 04             	mov    0x4(%eax),%eax
c0103823:	89 45 f0             	mov    %eax,-0x10(%ebp)

    for (i = 1; i <= step2; i ++) {
c0103826:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
c010382d:	e9 96 00 00 00       	jmp    c01038c8 <check_vma_struct+0x208>
        assert(le != &(mm->mmap_list));
c0103832:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103835:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0103838:	75 24                	jne    c010385e <check_vma_struct+0x19e>
c010383a:	c7 44 24 0c 88 aa 10 	movl   $0xc010aa88,0xc(%esp)
c0103841:	c0 
c0103842:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103849:	c0 
c010384a:	c7 44 24 04 c8 00 00 	movl   $0xc8,0x4(%esp)
c0103851:	00 
c0103852:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103859:	e8 df cb ff ff       	call   c010043d <__panic>
        struct vma_struct *mmap = le2vma(le, list_link);
c010385e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0103861:	83 e8 10             	sub    $0x10,%eax
c0103864:	89 45 c4             	mov    %eax,-0x3c(%ebp)
        assert(mmap->vm_start == i * 5 && mmap->vm_end == i * 5 + 2);
c0103867:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c010386a:	8b 48 04             	mov    0x4(%eax),%ecx
c010386d:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103870:	89 d0                	mov    %edx,%eax
c0103872:	c1 e0 02             	shl    $0x2,%eax
c0103875:	01 d0                	add    %edx,%eax
c0103877:	39 c1                	cmp    %eax,%ecx
c0103879:	75 17                	jne    c0103892 <check_vma_struct+0x1d2>
c010387b:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c010387e:	8b 48 08             	mov    0x8(%eax),%ecx
c0103881:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103884:	89 d0                	mov    %edx,%eax
c0103886:	c1 e0 02             	shl    $0x2,%eax
c0103889:	01 d0                	add    %edx,%eax
c010388b:	83 c0 02             	add    $0x2,%eax
c010388e:	39 c1                	cmp    %eax,%ecx
c0103890:	74 24                	je     c01038b6 <check_vma_struct+0x1f6>
c0103892:	c7 44 24 0c a0 aa 10 	movl   $0xc010aaa0,0xc(%esp)
c0103899:	c0 
c010389a:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c01038a1:	c0 
c01038a2:	c7 44 24 04 ca 00 00 	movl   $0xca,0x4(%esp)
c01038a9:	00 
c01038aa:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c01038b1:	e8 87 cb ff ff       	call   c010043d <__panic>
c01038b6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01038b9:	89 45 b4             	mov    %eax,-0x4c(%ebp)
c01038bc:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01038bf:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c01038c2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    for (i = 1; i <= step2; i ++) {
c01038c5:	ff 45 f4             	incl   -0xc(%ebp)
c01038c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01038cb:	3b 45 e0             	cmp    -0x20(%ebp),%eax
c01038ce:	0f 8e 5e ff ff ff    	jle    c0103832 <check_vma_struct+0x172>
    }

    for (i = 5; i <= 5 * step2; i +=5) {
c01038d4:	c7 45 f4 05 00 00 00 	movl   $0x5,-0xc(%ebp)
c01038db:	e9 cb 01 00 00       	jmp    c0103aab <check_vma_struct+0x3eb>
        struct vma_struct *vma1 = find_vma(mm, i);
c01038e0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01038e3:	89 44 24 04          	mov    %eax,0x4(%esp)
c01038e7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01038ea:	89 04 24             	mov    %eax,(%esp)
c01038ed:	e8 89 fa ff ff       	call   c010337b <find_vma>
c01038f2:	89 45 d8             	mov    %eax,-0x28(%ebp)
        assert(vma1 != NULL);
c01038f5:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c01038f9:	75 24                	jne    c010391f <check_vma_struct+0x25f>
c01038fb:	c7 44 24 0c d5 aa 10 	movl   $0xc010aad5,0xc(%esp)
c0103902:	c0 
c0103903:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c010390a:	c0 
c010390b:	c7 44 24 04 d0 00 00 	movl   $0xd0,0x4(%esp)
c0103912:	00 
c0103913:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c010391a:	e8 1e cb ff ff       	call   c010043d <__panic>
        struct vma_struct *vma2 = find_vma(mm, i+1);
c010391f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103922:	40                   	inc    %eax
c0103923:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103927:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010392a:	89 04 24             	mov    %eax,(%esp)
c010392d:	e8 49 fa ff ff       	call   c010337b <find_vma>
c0103932:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        assert(vma2 != NULL);
c0103935:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
c0103939:	75 24                	jne    c010395f <check_vma_struct+0x29f>
c010393b:	c7 44 24 0c e2 aa 10 	movl   $0xc010aae2,0xc(%esp)
c0103942:	c0 
c0103943:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c010394a:	c0 
c010394b:	c7 44 24 04 d2 00 00 	movl   $0xd2,0x4(%esp)
c0103952:	00 
c0103953:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c010395a:	e8 de ca ff ff       	call   c010043d <__panic>
        struct vma_struct *vma3 = find_vma(mm, i+2);
c010395f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103962:	83 c0 02             	add    $0x2,%eax
c0103965:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103969:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010396c:	89 04 24             	mov    %eax,(%esp)
c010396f:	e8 07 fa ff ff       	call   c010337b <find_vma>
c0103974:	89 45 d0             	mov    %eax,-0x30(%ebp)
        assert(vma3 == NULL);
c0103977:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c010397b:	74 24                	je     c01039a1 <check_vma_struct+0x2e1>
c010397d:	c7 44 24 0c ef aa 10 	movl   $0xc010aaef,0xc(%esp)
c0103984:	c0 
c0103985:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c010398c:	c0 
c010398d:	c7 44 24 04 d4 00 00 	movl   $0xd4,0x4(%esp)
c0103994:	00 
c0103995:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c010399c:	e8 9c ca ff ff       	call   c010043d <__panic>
        struct vma_struct *vma4 = find_vma(mm, i+3);
c01039a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01039a4:	83 c0 03             	add    $0x3,%eax
c01039a7:	89 44 24 04          	mov    %eax,0x4(%esp)
c01039ab:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01039ae:	89 04 24             	mov    %eax,(%esp)
c01039b1:	e8 c5 f9 ff ff       	call   c010337b <find_vma>
c01039b6:	89 45 cc             	mov    %eax,-0x34(%ebp)
        assert(vma4 == NULL);
c01039b9:	83 7d cc 00          	cmpl   $0x0,-0x34(%ebp)
c01039bd:	74 24                	je     c01039e3 <check_vma_struct+0x323>
c01039bf:	c7 44 24 0c fc aa 10 	movl   $0xc010aafc,0xc(%esp)
c01039c6:	c0 
c01039c7:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c01039ce:	c0 
c01039cf:	c7 44 24 04 d6 00 00 	movl   $0xd6,0x4(%esp)
c01039d6:	00 
c01039d7:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c01039de:	e8 5a ca ff ff       	call   c010043d <__panic>
        struct vma_struct *vma5 = find_vma(mm, i+4);
c01039e3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01039e6:	83 c0 04             	add    $0x4,%eax
c01039e9:	89 44 24 04          	mov    %eax,0x4(%esp)
c01039ed:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01039f0:	89 04 24             	mov    %eax,(%esp)
c01039f3:	e8 83 f9 ff ff       	call   c010337b <find_vma>
c01039f8:	89 45 c8             	mov    %eax,-0x38(%ebp)
        assert(vma5 == NULL);
c01039fb:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c01039ff:	74 24                	je     c0103a25 <check_vma_struct+0x365>
c0103a01:	c7 44 24 0c 09 ab 10 	movl   $0xc010ab09,0xc(%esp)
c0103a08:	c0 
c0103a09:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103a10:	c0 
c0103a11:	c7 44 24 04 d8 00 00 	movl   $0xd8,0x4(%esp)
c0103a18:	00 
c0103a19:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103a20:	e8 18 ca ff ff       	call   c010043d <__panic>

        assert(vma1->vm_start == i  && vma1->vm_end == i  + 2);
c0103a25:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0103a28:	8b 50 04             	mov    0x4(%eax),%edx
c0103a2b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103a2e:	39 c2                	cmp    %eax,%edx
c0103a30:	75 10                	jne    c0103a42 <check_vma_struct+0x382>
c0103a32:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0103a35:	8b 40 08             	mov    0x8(%eax),%eax
c0103a38:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103a3b:	83 c2 02             	add    $0x2,%edx
c0103a3e:	39 d0                	cmp    %edx,%eax
c0103a40:	74 24                	je     c0103a66 <check_vma_struct+0x3a6>
c0103a42:	c7 44 24 0c 18 ab 10 	movl   $0xc010ab18,0xc(%esp)
c0103a49:	c0 
c0103a4a:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103a51:	c0 
c0103a52:	c7 44 24 04 da 00 00 	movl   $0xda,0x4(%esp)
c0103a59:	00 
c0103a5a:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103a61:	e8 d7 c9 ff ff       	call   c010043d <__panic>
        assert(vma2->vm_start == i  && vma2->vm_end == i  + 2);
c0103a66:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0103a69:	8b 50 04             	mov    0x4(%eax),%edx
c0103a6c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103a6f:	39 c2                	cmp    %eax,%edx
c0103a71:	75 10                	jne    c0103a83 <check_vma_struct+0x3c3>
c0103a73:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0103a76:	8b 40 08             	mov    0x8(%eax),%eax
c0103a79:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103a7c:	83 c2 02             	add    $0x2,%edx
c0103a7f:	39 d0                	cmp    %edx,%eax
c0103a81:	74 24                	je     c0103aa7 <check_vma_struct+0x3e7>
c0103a83:	c7 44 24 0c 48 ab 10 	movl   $0xc010ab48,0xc(%esp)
c0103a8a:	c0 
c0103a8b:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103a92:	c0 
c0103a93:	c7 44 24 04 db 00 00 	movl   $0xdb,0x4(%esp)
c0103a9a:	00 
c0103a9b:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103aa2:	e8 96 c9 ff ff       	call   c010043d <__panic>
    for (i = 5; i <= 5 * step2; i +=5) {
c0103aa7:	83 45 f4 05          	addl   $0x5,-0xc(%ebp)
c0103aab:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0103aae:	89 d0                	mov    %edx,%eax
c0103ab0:	c1 e0 02             	shl    $0x2,%eax
c0103ab3:	01 d0                	add    %edx,%eax
c0103ab5:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0103ab8:	0f 8e 22 fe ff ff    	jle    c01038e0 <check_vma_struct+0x220>
    }

    for (i =4; i>=0; i--) {
c0103abe:	c7 45 f4 04 00 00 00 	movl   $0x4,-0xc(%ebp)
c0103ac5:	eb 6f                	jmp    c0103b36 <check_vma_struct+0x476>
        struct vma_struct *vma_below_5= find_vma(mm,i);
c0103ac7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103aca:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103ace:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103ad1:	89 04 24             	mov    %eax,(%esp)
c0103ad4:	e8 a2 f8 ff ff       	call   c010337b <find_vma>
c0103ad9:	89 45 dc             	mov    %eax,-0x24(%ebp)
        if (vma_below_5 != NULL ) {
c0103adc:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0103ae0:	74 27                	je     c0103b09 <check_vma_struct+0x449>
           cprintf("vma_below_5: i %x, start %x, end %x\n",i, vma_below_5->vm_start, vma_below_5->vm_end); 
c0103ae2:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103ae5:	8b 50 08             	mov    0x8(%eax),%edx
c0103ae8:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103aeb:	8b 40 04             	mov    0x4(%eax),%eax
c0103aee:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0103af2:	89 44 24 08          	mov    %eax,0x8(%esp)
c0103af6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103af9:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103afd:	c7 04 24 78 ab 10 c0 	movl   $0xc010ab78,(%esp)
c0103b04:	e8 c8 c7 ff ff       	call   c01002d1 <cprintf>
        }
        assert(vma_below_5 == NULL);
c0103b09:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0103b0d:	74 24                	je     c0103b33 <check_vma_struct+0x473>
c0103b0f:	c7 44 24 0c 9d ab 10 	movl   $0xc010ab9d,0xc(%esp)
c0103b16:	c0 
c0103b17:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103b1e:	c0 
c0103b1f:	c7 44 24 04 e3 00 00 	movl   $0xe3,0x4(%esp)
c0103b26:	00 
c0103b27:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103b2e:	e8 0a c9 ff ff       	call   c010043d <__panic>
    for (i =4; i>=0; i--) {
c0103b33:	ff 4d f4             	decl   -0xc(%ebp)
c0103b36:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103b3a:	79 8b                	jns    c0103ac7 <check_vma_struct+0x407>
    }

    mm_destroy(mm);
c0103b3c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103b3f:	89 04 24             	mov    %eax,(%esp)
c0103b42:	e8 c6 fa ff ff       	call   c010360d <mm_destroy>

//    assert(nr_free_pages_store == nr_free_pages());

    cprintf("check_vma_struct() succeeded!\n");
c0103b47:	c7 04 24 b4 ab 10 c0 	movl   $0xc010abb4,(%esp)
c0103b4e:	e8 7e c7 ff ff       	call   c01002d1 <cprintf>
}
c0103b53:	90                   	nop
c0103b54:	c9                   	leave  
c0103b55:	c3                   	ret    

c0103b56 <check_pgfault>:

struct mm_struct *check_mm_struct;

// check_pgfault - check correctness of pgfault handler
static void
check_pgfault(void) {
c0103b56:	f3 0f 1e fb          	endbr32 
c0103b5a:	55                   	push   %ebp
c0103b5b:	89 e5                	mov    %esp,%ebp
c0103b5d:	83 ec 38             	sub    $0x38,%esp
    size_t nr_free_pages_store = nr_free_pages();
c0103b60:	e8 3f 33 00 00       	call   c0106ea4 <nr_free_pages>
c0103b65:	89 45 ec             	mov    %eax,-0x14(%ebp)

    check_mm_struct = mm_create();
c0103b68:	e8 52 f7 ff ff       	call   c01032bf <mm_create>
c0103b6d:	a3 58 e0 12 c0       	mov    %eax,0xc012e058
    assert(check_mm_struct != NULL);
c0103b72:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c0103b77:	85 c0                	test   %eax,%eax
c0103b79:	75 24                	jne    c0103b9f <check_pgfault+0x49>
c0103b7b:	c7 44 24 0c d3 ab 10 	movl   $0xc010abd3,0xc(%esp)
c0103b82:	c0 
c0103b83:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103b8a:	c0 
c0103b8b:	c7 44 24 04 f5 00 00 	movl   $0xf5,0x4(%esp)
c0103b92:	00 
c0103b93:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103b9a:	e8 9e c8 ff ff       	call   c010043d <__panic>

    struct mm_struct *mm = check_mm_struct;
c0103b9f:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c0103ba4:	89 45 e8             	mov    %eax,-0x18(%ebp)
    pde_t *pgdir = mm->pgdir = boot_pgdir;
c0103ba7:	8b 15 20 8a 12 c0    	mov    0xc0128a20,%edx
c0103bad:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103bb0:	89 50 0c             	mov    %edx,0xc(%eax)
c0103bb3:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103bb6:	8b 40 0c             	mov    0xc(%eax),%eax
c0103bb9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(pgdir[0] == 0);
c0103bbc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103bbf:	8b 00                	mov    (%eax),%eax
c0103bc1:	85 c0                	test   %eax,%eax
c0103bc3:	74 24                	je     c0103be9 <check_pgfault+0x93>
c0103bc5:	c7 44 24 0c eb ab 10 	movl   $0xc010abeb,0xc(%esp)
c0103bcc:	c0 
c0103bcd:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103bd4:	c0 
c0103bd5:	c7 44 24 04 f9 00 00 	movl   $0xf9,0x4(%esp)
c0103bdc:	00 
c0103bdd:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103be4:	e8 54 c8 ff ff       	call   c010043d <__panic>

    struct vma_struct *vma = vma_create(0, PTSIZE, VM_WRITE);
c0103be9:	c7 44 24 08 02 00 00 	movl   $0x2,0x8(%esp)
c0103bf0:	00 
c0103bf1:	c7 44 24 04 00 00 40 	movl   $0x400000,0x4(%esp)
c0103bf8:	00 
c0103bf9:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0103c00:	e8 37 f7 ff ff       	call   c010333c <vma_create>
c0103c05:	89 45 e0             	mov    %eax,-0x20(%ebp)
    assert(vma != NULL);
c0103c08:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0103c0c:	75 24                	jne    c0103c32 <check_pgfault+0xdc>
c0103c0e:	c7 44 24 0c 7c aa 10 	movl   $0xc010aa7c,0xc(%esp)
c0103c15:	c0 
c0103c16:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103c1d:	c0 
c0103c1e:	c7 44 24 04 fc 00 00 	movl   $0xfc,0x4(%esp)
c0103c25:	00 
c0103c26:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103c2d:	e8 0b c8 ff ff       	call   c010043d <__panic>

    insert_vma_struct(mm, vma);
c0103c32:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103c35:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103c39:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103c3c:	89 04 24             	mov    %eax,(%esp)
c0103c3f:	e8 91 f8 ff ff       	call   c01034d5 <insert_vma_struct>

    uintptr_t addr = 0x100;
c0103c44:	c7 45 dc 00 01 00 00 	movl   $0x100,-0x24(%ebp)
    assert(find_vma(mm, addr) == vma);
c0103c4b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103c4e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103c52:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103c55:	89 04 24             	mov    %eax,(%esp)
c0103c58:	e8 1e f7 ff ff       	call   c010337b <find_vma>
c0103c5d:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0103c60:	74 24                	je     c0103c86 <check_pgfault+0x130>
c0103c62:	c7 44 24 0c f9 ab 10 	movl   $0xc010abf9,0xc(%esp)
c0103c69:	c0 
c0103c6a:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103c71:	c0 
c0103c72:	c7 44 24 04 01 01 00 	movl   $0x101,0x4(%esp)
c0103c79:	00 
c0103c7a:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103c81:	e8 b7 c7 ff ff       	call   c010043d <__panic>

    int i, sum = 0;
c0103c86:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0103c8d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0103c94:	eb 16                	jmp    c0103cac <check_pgfault+0x156>
        *(char *)(addr + i) = i;
c0103c96:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103c99:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103c9c:	01 d0                	add    %edx,%eax
c0103c9e:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103ca1:	88 10                	mov    %dl,(%eax)
        sum += i;
c0103ca3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0103ca6:	01 45 f0             	add    %eax,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0103ca9:	ff 45 f4             	incl   -0xc(%ebp)
c0103cac:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0103cb0:	7e e4                	jle    c0103c96 <check_pgfault+0x140>
    }
    for (i = 0; i < 100; i ++) {
c0103cb2:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0103cb9:	eb 14                	jmp    c0103ccf <check_pgfault+0x179>
        sum -= *(char *)(addr + i);
c0103cbb:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0103cbe:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103cc1:	01 d0                	add    %edx,%eax
c0103cc3:	0f b6 00             	movzbl (%eax),%eax
c0103cc6:	0f be c0             	movsbl %al,%eax
c0103cc9:	29 45 f0             	sub    %eax,-0x10(%ebp)
    for (i = 0; i < 100; i ++) {
c0103ccc:	ff 45 f4             	incl   -0xc(%ebp)
c0103ccf:	83 7d f4 63          	cmpl   $0x63,-0xc(%ebp)
c0103cd3:	7e e6                	jle    c0103cbb <check_pgfault+0x165>
    }
    assert(sum == 0);
c0103cd5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0103cd9:	74 24                	je     c0103cff <check_pgfault+0x1a9>
c0103cdb:	c7 44 24 0c 13 ac 10 	movl   $0xc010ac13,0xc(%esp)
c0103ce2:	c0 
c0103ce3:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103cea:	c0 
c0103ceb:	c7 44 24 04 0b 01 00 	movl   $0x10b,0x4(%esp)
c0103cf2:	00 
c0103cf3:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103cfa:	e8 3e c7 ff ff       	call   c010043d <__panic>

    page_remove(pgdir, ROUNDDOWN(addr, PGSIZE));
c0103cff:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0103d02:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0103d05:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0103d08:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103d0d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103d11:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103d14:	89 04 24             	mov    %eax,(%esp)
c0103d17:	e8 ae 39 00 00       	call   c01076ca <page_remove>
    free_page(pde2page(pgdir[0]));
c0103d1c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103d1f:	8b 00                	mov    (%eax),%eax
c0103d21:	89 04 24             	mov    %eax,(%esp)
c0103d24:	e8 7e f5 ff ff       	call   c01032a7 <pde2page>
c0103d29:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0103d30:	00 
c0103d31:	89 04 24             	mov    %eax,(%esp)
c0103d34:	e8 34 31 00 00       	call   c0106e6d <free_pages>
    pgdir[0] = 0;
c0103d39:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103d3c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    mm->pgdir = NULL;
c0103d42:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103d45:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    mm_destroy(mm);
c0103d4c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103d4f:	89 04 24             	mov    %eax,(%esp)
c0103d52:	e8 b6 f8 ff ff       	call   c010360d <mm_destroy>
    check_mm_struct = NULL;
c0103d57:	c7 05 58 e0 12 c0 00 	movl   $0x0,0xc012e058
c0103d5e:	00 00 00 

    assert(nr_free_pages_store == nr_free_pages());
c0103d61:	e8 3e 31 00 00       	call   c0106ea4 <nr_free_pages>
c0103d66:	39 45 ec             	cmp    %eax,-0x14(%ebp)
c0103d69:	74 24                	je     c0103d8f <check_pgfault+0x239>
c0103d6b:	c7 44 24 0c 1c ac 10 	movl   $0xc010ac1c,0xc(%esp)
c0103d72:	c0 
c0103d73:	c7 44 24 08 db a9 10 	movl   $0xc010a9db,0x8(%esp)
c0103d7a:	c0 
c0103d7b:	c7 44 24 04 15 01 00 	movl   $0x115,0x4(%esp)
c0103d82:	00 
c0103d83:	c7 04 24 f0 a9 10 c0 	movl   $0xc010a9f0,(%esp)
c0103d8a:	e8 ae c6 ff ff       	call   c010043d <__panic>

    cprintf("check_pgfault() succeeded!\n");
c0103d8f:	c7 04 24 43 ac 10 c0 	movl   $0xc010ac43,(%esp)
c0103d96:	e8 36 c5 ff ff       	call   c01002d1 <cprintf>
}
c0103d9b:	90                   	nop
c0103d9c:	c9                   	leave  
c0103d9d:	c3                   	ret    

c0103d9e <do_pgfault>:
 *            was a read (0) or write (1).
 *         -- The U/S flag (bit 2) indicates whether the processor was executing at user mode (1)
 *            or supervisor mode (0) at the time of the exception.
 */
int
do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
c0103d9e:	f3 0f 1e fb          	endbr32 
c0103da2:	55                   	push   %ebp
c0103da3:	89 e5                	mov    %esp,%ebp
c0103da5:	83 ec 38             	sub    $0x38,%esp
    int ret = -E_INVAL;
c0103da8:	c7 45 f4 fd ff ff ff 	movl   $0xfffffffd,-0xc(%ebp)
    //try to find a vma which include addr
    struct vma_struct *vma = find_vma(mm, addr);
c0103daf:	8b 45 10             	mov    0x10(%ebp),%eax
c0103db2:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103db6:	8b 45 08             	mov    0x8(%ebp),%eax
c0103db9:	89 04 24             	mov    %eax,(%esp)
c0103dbc:	e8 ba f5 ff ff       	call   c010337b <find_vma>
c0103dc1:	89 45 ec             	mov    %eax,-0x14(%ebp)

    pgfault_num++;
c0103dc4:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c0103dc9:	40                   	inc    %eax
c0103dca:	a3 64 bf 12 c0       	mov    %eax,0xc012bf64
    //If the addr is in the range of a mm's vma?
    if (vma == NULL || vma->vm_start > addr) {
c0103dcf:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0103dd3:	74 0b                	je     c0103de0 <do_pgfault+0x42>
c0103dd5:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103dd8:	8b 40 04             	mov    0x4(%eax),%eax
c0103ddb:	39 45 10             	cmp    %eax,0x10(%ebp)
c0103dde:	73 18                	jae    c0103df8 <do_pgfault+0x5a>
        cprintf("not valid addr %x, and  can not find it in vma\n", addr);
c0103de0:	8b 45 10             	mov    0x10(%ebp),%eax
c0103de3:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103de7:	c7 04 24 60 ac 10 c0 	movl   $0xc010ac60,(%esp)
c0103dee:	e8 de c4 ff ff       	call   c01002d1 <cprintf>
        goto failed;
c0103df3:	e9 ba 01 00 00       	jmp    c0103fb2 <do_pgfault+0x214>
    }
    //check the error_code
    switch (error_code & 3) {
c0103df8:	8b 45 0c             	mov    0xc(%ebp),%eax
c0103dfb:	83 e0 03             	and    $0x3,%eax
c0103dfe:	85 c0                	test   %eax,%eax
c0103e00:	74 34                	je     c0103e36 <do_pgfault+0x98>
c0103e02:	83 f8 01             	cmp    $0x1,%eax
c0103e05:	74 1e                	je     c0103e25 <do_pgfault+0x87>
    default:
            /* error code flag : default is 3 ( W/R=1, P=1): write, present */
    case 2: /* error code flag : (W/R=1, P=0): write, not present */
        if (!(vma->vm_flags & VM_WRITE)) {
c0103e07:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103e0a:	8b 40 0c             	mov    0xc(%eax),%eax
c0103e0d:	83 e0 02             	and    $0x2,%eax
c0103e10:	85 c0                	test   %eax,%eax
c0103e12:	75 40                	jne    c0103e54 <do_pgfault+0xb6>
            cprintf("do_pgfault failed: error code flag = write AND not present, but the addr's vma cannot write\n");
c0103e14:	c7 04 24 90 ac 10 c0 	movl   $0xc010ac90,(%esp)
c0103e1b:	e8 b1 c4 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0103e20:	e9 8d 01 00 00       	jmp    c0103fb2 <do_pgfault+0x214>
        }
        break;
    case 1: /* error code flag : (W/R=0, P=1): read, present */
        cprintf("do_pgfault failed: error code flag = read AND present\n");
c0103e25:	c7 04 24 f0 ac 10 c0 	movl   $0xc010acf0,(%esp)
c0103e2c:	e8 a0 c4 ff ff       	call   c01002d1 <cprintf>
        goto failed;
c0103e31:	e9 7c 01 00 00       	jmp    c0103fb2 <do_pgfault+0x214>
    case 0: /* error code flag : (W/R=0, P=0): read, not present */
        if (!(vma->vm_flags & (VM_READ | VM_EXEC))) {
c0103e36:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103e39:	8b 40 0c             	mov    0xc(%eax),%eax
c0103e3c:	83 e0 05             	and    $0x5,%eax
c0103e3f:	85 c0                	test   %eax,%eax
c0103e41:	75 12                	jne    c0103e55 <do_pgfault+0xb7>
            cprintf("do_pgfault failed: error code flag = read AND not present, but the addr's vma cannot read or exec\n");
c0103e43:	c7 04 24 28 ad 10 c0 	movl   $0xc010ad28,(%esp)
c0103e4a:	e8 82 c4 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0103e4f:	e9 5e 01 00 00       	jmp    c0103fb2 <do_pgfault+0x214>
        break;
c0103e54:	90                   	nop
     *    (write an non_existed addr && addr is writable) OR
     *    (read  an non_existed addr && addr is readable)
     * THEN
     *    continue process
     */
    uint32_t perm = PTE_U;
c0103e55:	c7 45 f0 04 00 00 00 	movl   $0x4,-0x10(%ebp)
    if (vma->vm_flags & VM_WRITE) {
c0103e5c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0103e5f:	8b 40 0c             	mov    0xc(%eax),%eax
c0103e62:	83 e0 02             	and    $0x2,%eax
c0103e65:	85 c0                	test   %eax,%eax
c0103e67:	74 04                	je     c0103e6d <do_pgfault+0xcf>
        perm |= PTE_W;
c0103e69:	83 4d f0 02          	orl    $0x2,-0x10(%ebp)
    }
    addr = ROUNDDOWN(addr, PGSIZE);
c0103e6d:	8b 45 10             	mov    0x10(%ebp),%eax
c0103e70:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0103e73:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0103e76:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0103e7b:	89 45 10             	mov    %eax,0x10(%ebp)

    ret = -E_NO_MEM;
c0103e7e:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)

    pte_t *ptep=NULL;
c0103e85:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
        }
   }
#endif
    // try to find a pte, if pte's PT(Page Table) isn't existed, then create a PT.
    // (notice the 3th parameter '1')
    if ((ptep = get_pte(mm->pgdir, addr, 1)) == NULL) {
c0103e8c:	8b 45 08             	mov    0x8(%ebp),%eax
c0103e8f:	8b 40 0c             	mov    0xc(%eax),%eax
c0103e92:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0103e99:	00 
c0103e9a:	8b 55 10             	mov    0x10(%ebp),%edx
c0103e9d:	89 54 24 04          	mov    %edx,0x4(%esp)
c0103ea1:	89 04 24             	mov    %eax,(%esp)
c0103ea4:	e8 25 36 00 00       	call   c01074ce <get_pte>
c0103ea9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0103eac:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0103eb0:	75 11                	jne    c0103ec3 <do_pgfault+0x125>
        cprintf("get_pte in do_pgfault failed\n");
c0103eb2:	c7 04 24 8b ad 10 c0 	movl   $0xc010ad8b,(%esp)
c0103eb9:	e8 13 c4 ff ff       	call   c01002d1 <cprintf>
        goto failed;
c0103ebe:	e9 ef 00 00 00       	jmp    c0103fb2 <do_pgfault+0x214>
    }
    
    if (*ptep == 0) { // if the phy addr isn't exist, then alloc a page & map the phy addr with logical addr
c0103ec3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103ec6:	8b 00                	mov    (%eax),%eax
c0103ec8:	85 c0                	test   %eax,%eax
c0103eca:	75 35                	jne    c0103f01 <do_pgfault+0x163>
        if (pgdir_alloc_page(mm->pgdir, addr, perm) == NULL) {
c0103ecc:	8b 45 08             	mov    0x8(%ebp),%eax
c0103ecf:	8b 40 0c             	mov    0xc(%eax),%eax
c0103ed2:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0103ed5:	89 54 24 08          	mov    %edx,0x8(%esp)
c0103ed9:	8b 55 10             	mov    0x10(%ebp),%edx
c0103edc:	89 54 24 04          	mov    %edx,0x4(%esp)
c0103ee0:	89 04 24             	mov    %eax,(%esp)
c0103ee3:	e8 49 39 00 00       	call   c0107831 <pgdir_alloc_page>
c0103ee8:	85 c0                	test   %eax,%eax
c0103eea:	0f 85 bb 00 00 00    	jne    c0103fab <do_pgfault+0x20d>
            cprintf("pgdir_alloc_page in do_pgfault failed\n");
c0103ef0:	c7 04 24 ac ad 10 c0 	movl   $0xc010adac,(%esp)
c0103ef7:	e8 d5 c3 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0103efc:	e9 b1 00 00 00       	jmp    c0103fb2 <do_pgfault+0x214>
        }
    }
    else { // if this pte is a swap entry, then load data from disk to a page with phy addr
           // and call page_insert to map the phy addr with logical addr
        if(swap_init_ok) {
c0103f01:	a1 68 bf 12 c0       	mov    0xc012bf68,%eax
c0103f06:	85 c0                	test   %eax,%eax
c0103f08:	0f 84 86 00 00 00    	je     c0103f94 <do_pgfault+0x1f6>
            struct Page *page=NULL;
c0103f0e:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
            if ((ret = swap_in(mm, addr, &page)) != 0) {
c0103f15:	8d 45 e0             	lea    -0x20(%ebp),%eax
c0103f18:	89 44 24 08          	mov    %eax,0x8(%esp)
c0103f1c:	8b 45 10             	mov    0x10(%ebp),%eax
c0103f1f:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103f23:	8b 45 08             	mov    0x8(%ebp),%eax
c0103f26:	89 04 24             	mov    %eax,(%esp)
c0103f29:	e8 a6 03 00 00       	call   c01042d4 <swap_in>
c0103f2e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0103f31:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0103f35:	74 0e                	je     c0103f45 <do_pgfault+0x1a7>
                cprintf("swap_in in do_pgfault failed\n");
c0103f37:	c7 04 24 d3 ad 10 c0 	movl   $0xc010add3,(%esp)
c0103f3e:	e8 8e c3 ff ff       	call   c01002d1 <cprintf>
c0103f43:	eb 6d                	jmp    c0103fb2 <do_pgfault+0x214>
                goto failed;
            }    
            page_insert(mm->pgdir, page, addr, perm);
c0103f45:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0103f48:	8b 45 08             	mov    0x8(%ebp),%eax
c0103f4b:	8b 40 0c             	mov    0xc(%eax),%eax
c0103f4e:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0103f51:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0103f55:	8b 4d 10             	mov    0x10(%ebp),%ecx
c0103f58:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0103f5c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0103f60:	89 04 24             	mov    %eax,(%esp)
c0103f63:	e8 ab 37 00 00       	call   c0107713 <page_insert>
            swap_map_swappable(mm, addr, page, 1);
c0103f68:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103f6b:	c7 44 24 0c 01 00 00 	movl   $0x1,0xc(%esp)
c0103f72:	00 
c0103f73:	89 44 24 08          	mov    %eax,0x8(%esp)
c0103f77:	8b 45 10             	mov    0x10(%ebp),%eax
c0103f7a:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103f7e:	8b 45 08             	mov    0x8(%ebp),%eax
c0103f81:	89 04 24             	mov    %eax,(%esp)
c0103f84:	e8 7d 01 00 00       	call   c0104106 <swap_map_swappable>
            page->pra_vaddr = addr;
c0103f89:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0103f8c:	8b 55 10             	mov    0x10(%ebp),%edx
c0103f8f:	89 50 1c             	mov    %edx,0x1c(%eax)
c0103f92:	eb 17                	jmp    c0103fab <do_pgfault+0x20d>
        }
        else {
            cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
c0103f94:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0103f97:	8b 00                	mov    (%eax),%eax
c0103f99:	89 44 24 04          	mov    %eax,0x4(%esp)
c0103f9d:	c7 04 24 f4 ad 10 c0 	movl   $0xc010adf4,(%esp)
c0103fa4:	e8 28 c3 ff ff       	call   c01002d1 <cprintf>
            goto failed;
c0103fa9:	eb 07                	jmp    c0103fb2 <do_pgfault+0x214>
        }
   }
   ret = 0;
c0103fab:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
failed:
    return ret;
c0103fb2:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0103fb5:	c9                   	leave  
c0103fb6:	c3                   	ret    

c0103fb7 <pa2page>:
pa2page(uintptr_t pa) {
c0103fb7:	55                   	push   %ebp
c0103fb8:	89 e5                	mov    %esp,%ebp
c0103fba:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0103fbd:	8b 45 08             	mov    0x8(%ebp),%eax
c0103fc0:	c1 e8 0c             	shr    $0xc,%eax
c0103fc3:	89 c2                	mov    %eax,%edx
c0103fc5:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0103fca:	39 c2                	cmp    %eax,%edx
c0103fcc:	72 1c                	jb     c0103fea <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0103fce:	c7 44 24 08 1c ae 10 	movl   $0xc010ae1c,0x8(%esp)
c0103fd5:	c0 
c0103fd6:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0103fdd:	00 
c0103fde:	c7 04 24 3b ae 10 c0 	movl   $0xc010ae3b,(%esp)
c0103fe5:	e8 53 c4 ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0103fea:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c0103fef:	8b 55 08             	mov    0x8(%ebp),%edx
c0103ff2:	c1 ea 0c             	shr    $0xc,%edx
c0103ff5:	c1 e2 05             	shl    $0x5,%edx
c0103ff8:	01 d0                	add    %edx,%eax
}
c0103ffa:	c9                   	leave  
c0103ffb:	c3                   	ret    

c0103ffc <pte2page>:
pte2page(pte_t pte) {
c0103ffc:	55                   	push   %ebp
c0103ffd:	89 e5                	mov    %esp,%ebp
c0103fff:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c0104002:	8b 45 08             	mov    0x8(%ebp),%eax
c0104005:	83 e0 01             	and    $0x1,%eax
c0104008:	85 c0                	test   %eax,%eax
c010400a:	75 1c                	jne    c0104028 <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c010400c:	c7 44 24 08 4c ae 10 	movl   $0xc010ae4c,0x8(%esp)
c0104013:	c0 
c0104014:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c010401b:	00 
c010401c:	c7 04 24 3b ae 10 c0 	movl   $0xc010ae3b,(%esp)
c0104023:	e8 15 c4 ff ff       	call   c010043d <__panic>
    return pa2page(PTE_ADDR(pte));
c0104028:	8b 45 08             	mov    0x8(%ebp),%eax
c010402b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0104030:	89 04 24             	mov    %eax,(%esp)
c0104033:	e8 7f ff ff ff       	call   c0103fb7 <pa2page>
}
c0104038:	c9                   	leave  
c0104039:	c3                   	ret    

c010403a <swap_init>:

static void check_swap(void);

int
swap_init(void)
{
c010403a:	f3 0f 1e fb          	endbr32 
c010403e:	55                   	push   %ebp
c010403f:	89 e5                	mov    %esp,%ebp
c0104041:	83 ec 28             	sub    $0x28,%esp
     swapfs_init();
c0104044:	e8 f5 45 00 00       	call   c010863e <swapfs_init>

     if (!(1024 <= max_swap_offset && max_swap_offset < MAX_SWAP_OFFSET_LIMIT))
c0104049:	a1 fc e0 12 c0       	mov    0xc012e0fc,%eax
c010404e:	3d ff 03 00 00       	cmp    $0x3ff,%eax
c0104053:	76 0c                	jbe    c0104061 <swap_init+0x27>
c0104055:	a1 fc e0 12 c0       	mov    0xc012e0fc,%eax
c010405a:	3d ff ff ff 00       	cmp    $0xffffff,%eax
c010405f:	76 25                	jbe    c0104086 <swap_init+0x4c>
     {
          panic("bad max_swap_offset %08x.\n", max_swap_offset);
c0104061:	a1 fc e0 12 c0       	mov    0xc012e0fc,%eax
c0104066:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010406a:	c7 44 24 08 6d ae 10 	movl   $0xc010ae6d,0x8(%esp)
c0104071:	c0 
c0104072:	c7 44 24 04 25 00 00 	movl   $0x25,0x4(%esp)
c0104079:	00 
c010407a:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104081:	e8 b7 c3 ff ff       	call   c010043d <__panic>
     }
     

     sm = &swap_manager_fifo;
c0104086:	c7 05 70 bf 12 c0 00 	movl   $0xc0128a00,0xc012bf70
c010408d:	8a 12 c0 
     int r = sm->init();
c0104090:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c0104095:	8b 40 04             	mov    0x4(%eax),%eax
c0104098:	ff d0                	call   *%eax
c010409a:	89 45 f4             	mov    %eax,-0xc(%ebp)
     
     if (r == 0)
c010409d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01040a1:	75 26                	jne    c01040c9 <swap_init+0x8f>
     {
          swap_init_ok = 1;
c01040a3:	c7 05 68 bf 12 c0 01 	movl   $0x1,0xc012bf68
c01040aa:	00 00 00 
          cprintf("SWAP: manager = %s\n", sm->name);
c01040ad:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c01040b2:	8b 00                	mov    (%eax),%eax
c01040b4:	89 44 24 04          	mov    %eax,0x4(%esp)
c01040b8:	c7 04 24 97 ae 10 c0 	movl   $0xc010ae97,(%esp)
c01040bf:	e8 0d c2 ff ff       	call   c01002d1 <cprintf>
          check_swap();
c01040c4:	e8 b6 04 00 00       	call   c010457f <check_swap>
     }

     return r;
c01040c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01040cc:	c9                   	leave  
c01040cd:	c3                   	ret    

c01040ce <swap_init_mm>:

int
swap_init_mm(struct mm_struct *mm)
{
c01040ce:	f3 0f 1e fb          	endbr32 
c01040d2:	55                   	push   %ebp
c01040d3:	89 e5                	mov    %esp,%ebp
c01040d5:	83 ec 18             	sub    $0x18,%esp
     return sm->init_mm(mm);
c01040d8:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c01040dd:	8b 40 08             	mov    0x8(%eax),%eax
c01040e0:	8b 55 08             	mov    0x8(%ebp),%edx
c01040e3:	89 14 24             	mov    %edx,(%esp)
c01040e6:	ff d0                	call   *%eax
}
c01040e8:	c9                   	leave  
c01040e9:	c3                   	ret    

c01040ea <swap_tick_event>:

int
swap_tick_event(struct mm_struct *mm)
{
c01040ea:	f3 0f 1e fb          	endbr32 
c01040ee:	55                   	push   %ebp
c01040ef:	89 e5                	mov    %esp,%ebp
c01040f1:	83 ec 18             	sub    $0x18,%esp
     return sm->tick_event(mm);
c01040f4:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c01040f9:	8b 40 0c             	mov    0xc(%eax),%eax
c01040fc:	8b 55 08             	mov    0x8(%ebp),%edx
c01040ff:	89 14 24             	mov    %edx,(%esp)
c0104102:	ff d0                	call   *%eax
}
c0104104:	c9                   	leave  
c0104105:	c3                   	ret    

c0104106 <swap_map_swappable>:

int
swap_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c0104106:	f3 0f 1e fb          	endbr32 
c010410a:	55                   	push   %ebp
c010410b:	89 e5                	mov    %esp,%ebp
c010410d:	83 ec 18             	sub    $0x18,%esp
     return sm->map_swappable(mm, addr, page, swap_in);
c0104110:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c0104115:	8b 40 10             	mov    0x10(%eax),%eax
c0104118:	8b 55 14             	mov    0x14(%ebp),%edx
c010411b:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010411f:	8b 55 10             	mov    0x10(%ebp),%edx
c0104122:	89 54 24 08          	mov    %edx,0x8(%esp)
c0104126:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104129:	89 54 24 04          	mov    %edx,0x4(%esp)
c010412d:	8b 55 08             	mov    0x8(%ebp),%edx
c0104130:	89 14 24             	mov    %edx,(%esp)
c0104133:	ff d0                	call   *%eax
}
c0104135:	c9                   	leave  
c0104136:	c3                   	ret    

c0104137 <swap_set_unswappable>:

int
swap_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c0104137:	f3 0f 1e fb          	endbr32 
c010413b:	55                   	push   %ebp
c010413c:	89 e5                	mov    %esp,%ebp
c010413e:	83 ec 18             	sub    $0x18,%esp
     return sm->set_unswappable(mm, addr);
c0104141:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c0104146:	8b 40 14             	mov    0x14(%eax),%eax
c0104149:	8b 55 0c             	mov    0xc(%ebp),%edx
c010414c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104150:	8b 55 08             	mov    0x8(%ebp),%edx
c0104153:	89 14 24             	mov    %edx,(%esp)
c0104156:	ff d0                	call   *%eax
}
c0104158:	c9                   	leave  
c0104159:	c3                   	ret    

c010415a <swap_out>:

volatile unsigned int swap_out_num=0;

int
swap_out(struct mm_struct *mm, int n, int in_tick)
{
c010415a:	f3 0f 1e fb          	endbr32 
c010415e:	55                   	push   %ebp
c010415f:	89 e5                	mov    %esp,%ebp
c0104161:	83 ec 38             	sub    $0x38,%esp
     int i;
     for (i = 0; i != n; ++ i)
c0104164:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c010416b:	e9 53 01 00 00       	jmp    c01042c3 <swap_out+0x169>
     {
          uintptr_t v;
          //struct Page **ptr_page=NULL;
          struct Page *page;
          // cprintf("i %d, SWAP: call swap_out_victim\n",i);
          int r = sm->swap_out_victim(mm, &page, in_tick);
c0104170:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c0104175:	8b 40 18             	mov    0x18(%eax),%eax
c0104178:	8b 55 10             	mov    0x10(%ebp),%edx
c010417b:	89 54 24 08          	mov    %edx,0x8(%esp)
c010417f:	8d 55 e4             	lea    -0x1c(%ebp),%edx
c0104182:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104186:	8b 55 08             	mov    0x8(%ebp),%edx
c0104189:	89 14 24             	mov    %edx,(%esp)
c010418c:	ff d0                	call   *%eax
c010418e:	89 45 f0             	mov    %eax,-0x10(%ebp)
          if (r != 0) {
c0104191:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104195:	74 18                	je     c01041af <swap_out+0x55>
                    cprintf("i %d, swap_out: call swap_out_victim failed\n",i);
c0104197:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010419a:	89 44 24 04          	mov    %eax,0x4(%esp)
c010419e:	c7 04 24 ac ae 10 c0 	movl   $0xc010aeac,(%esp)
c01041a5:	e8 27 c1 ff ff       	call   c01002d1 <cprintf>
c01041aa:	e9 20 01 00 00       	jmp    c01042cf <swap_out+0x175>
          }          
          //assert(!PageReserved(page));

          //cprintf("SWAP: choose victim page 0x%08x\n", page);
          
          v=page->pra_vaddr; 
c01041af:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01041b2:	8b 40 1c             	mov    0x1c(%eax),%eax
c01041b5:	89 45 ec             	mov    %eax,-0x14(%ebp)
          pte_t *ptep = get_pte(mm->pgdir, v, 0);
c01041b8:	8b 45 08             	mov    0x8(%ebp),%eax
c01041bb:	8b 40 0c             	mov    0xc(%eax),%eax
c01041be:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01041c5:	00 
c01041c6:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01041c9:	89 54 24 04          	mov    %edx,0x4(%esp)
c01041cd:	89 04 24             	mov    %eax,(%esp)
c01041d0:	e8 f9 32 00 00       	call   c01074ce <get_pte>
c01041d5:	89 45 e8             	mov    %eax,-0x18(%ebp)
          assert((*ptep & PTE_P) != 0);
c01041d8:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01041db:	8b 00                	mov    (%eax),%eax
c01041dd:	83 e0 01             	and    $0x1,%eax
c01041e0:	85 c0                	test   %eax,%eax
c01041e2:	75 24                	jne    c0104208 <swap_out+0xae>
c01041e4:	c7 44 24 0c d9 ae 10 	movl   $0xc010aed9,0xc(%esp)
c01041eb:	c0 
c01041ec:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01041f3:	c0 
c01041f4:	c7 44 24 04 65 00 00 	movl   $0x65,0x4(%esp)
c01041fb:	00 
c01041fc:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104203:	e8 35 c2 ff ff       	call   c010043d <__panic>

          if (swapfs_write( (page->pra_vaddr/PGSIZE+1)<<8, page) != 0) {
c0104208:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010420b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010420e:	8b 52 1c             	mov    0x1c(%edx),%edx
c0104211:	c1 ea 0c             	shr    $0xc,%edx
c0104214:	42                   	inc    %edx
c0104215:	c1 e2 08             	shl    $0x8,%edx
c0104218:	89 44 24 04          	mov    %eax,0x4(%esp)
c010421c:	89 14 24             	mov    %edx,(%esp)
c010421f:	e8 dd 44 00 00       	call   c0108701 <swapfs_write>
c0104224:	85 c0                	test   %eax,%eax
c0104226:	74 34                	je     c010425c <swap_out+0x102>
                    cprintf("SWAP: failed to save\n");
c0104228:	c7 04 24 03 af 10 c0 	movl   $0xc010af03,(%esp)
c010422f:	e8 9d c0 ff ff       	call   c01002d1 <cprintf>
                    sm->map_swappable(mm, v, page, 0);
c0104234:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c0104239:	8b 40 10             	mov    0x10(%eax),%eax
c010423c:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010423f:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0104246:	00 
c0104247:	89 54 24 08          	mov    %edx,0x8(%esp)
c010424b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010424e:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104252:	8b 55 08             	mov    0x8(%ebp),%edx
c0104255:	89 14 24             	mov    %edx,(%esp)
c0104258:	ff d0                	call   *%eax
c010425a:	eb 64                	jmp    c01042c0 <swap_out+0x166>
                    continue;
          }
          else {
                    cprintf("swap_out: i %d, store page in vaddr 0x%x to disk swap entry %d\n", i, v, page->pra_vaddr/PGSIZE+1);
c010425c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010425f:	8b 40 1c             	mov    0x1c(%eax),%eax
c0104262:	c1 e8 0c             	shr    $0xc,%eax
c0104265:	40                   	inc    %eax
c0104266:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010426a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010426d:	89 44 24 08          	mov    %eax,0x8(%esp)
c0104271:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104274:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104278:	c7 04 24 1c af 10 c0 	movl   $0xc010af1c,(%esp)
c010427f:	e8 4d c0 ff ff       	call   c01002d1 <cprintf>
                    *ptep = (page->pra_vaddr/PGSIZE+1)<<8;
c0104284:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104287:	8b 40 1c             	mov    0x1c(%eax),%eax
c010428a:	c1 e8 0c             	shr    $0xc,%eax
c010428d:	40                   	inc    %eax
c010428e:	c1 e0 08             	shl    $0x8,%eax
c0104291:	89 c2                	mov    %eax,%edx
c0104293:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104296:	89 10                	mov    %edx,(%eax)
                    free_page(page);
c0104298:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010429b:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01042a2:	00 
c01042a3:	89 04 24             	mov    %eax,(%esp)
c01042a6:	e8 c2 2b 00 00       	call   c0106e6d <free_pages>
          }
          
          tlb_invalidate(mm->pgdir, v);
c01042ab:	8b 45 08             	mov    0x8(%ebp),%eax
c01042ae:	8b 40 0c             	mov    0xc(%eax),%eax
c01042b1:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01042b4:	89 54 24 04          	mov    %edx,0x4(%esp)
c01042b8:	89 04 24             	mov    %eax,(%esp)
c01042bb:	e8 10 35 00 00       	call   c01077d0 <tlb_invalidate>
     for (i = 0; i != n; ++ i)
c01042c0:	ff 45 f4             	incl   -0xc(%ebp)
c01042c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01042c6:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01042c9:	0f 85 a1 fe ff ff    	jne    c0104170 <swap_out+0x16>
     }
     return i;
c01042cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01042d2:	c9                   	leave  
c01042d3:	c3                   	ret    

c01042d4 <swap_in>:

int
swap_in(struct mm_struct *mm, uintptr_t addr, struct Page **ptr_result)
{
c01042d4:	f3 0f 1e fb          	endbr32 
c01042d8:	55                   	push   %ebp
c01042d9:	89 e5                	mov    %esp,%ebp
c01042db:	83 ec 28             	sub    $0x28,%esp
     struct Page *result = alloc_page();
c01042de:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01042e5:	e8 14 2b 00 00       	call   c0106dfe <alloc_pages>
c01042ea:	89 45 f4             	mov    %eax,-0xc(%ebp)
     assert(result!=NULL);
c01042ed:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01042f1:	75 24                	jne    c0104317 <swap_in+0x43>
c01042f3:	c7 44 24 0c 5c af 10 	movl   $0xc010af5c,0xc(%esp)
c01042fa:	c0 
c01042fb:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104302:	c0 
c0104303:	c7 44 24 04 7b 00 00 	movl   $0x7b,0x4(%esp)
c010430a:	00 
c010430b:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104312:	e8 26 c1 ff ff       	call   c010043d <__panic>

     pte_t *ptep = get_pte(mm->pgdir, addr, 0);
c0104317:	8b 45 08             	mov    0x8(%ebp),%eax
c010431a:	8b 40 0c             	mov    0xc(%eax),%eax
c010431d:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104324:	00 
c0104325:	8b 55 0c             	mov    0xc(%ebp),%edx
c0104328:	89 54 24 04          	mov    %edx,0x4(%esp)
c010432c:	89 04 24             	mov    %eax,(%esp)
c010432f:	e8 9a 31 00 00       	call   c01074ce <get_pte>
c0104334:	89 45 f0             	mov    %eax,-0x10(%ebp)
     // cprintf("SWAP: load ptep %x swap entry %d to vaddr 0x%08x, page %x, No %d\n", ptep, (*ptep)>>8, addr, result, (result-pages));
    
     int r;
     if ((r = swapfs_read((*ptep), result)) != 0)
c0104337:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010433a:	8b 00                	mov    (%eax),%eax
c010433c:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010433f:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104343:	89 04 24             	mov    %eax,(%esp)
c0104346:	e8 40 43 00 00       	call   c010868b <swapfs_read>
c010434b:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010434e:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0104352:	74 2a                	je     c010437e <swap_in+0xaa>
     {
        assert(r!=0);
c0104354:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0104358:	75 24                	jne    c010437e <swap_in+0xaa>
c010435a:	c7 44 24 0c 69 af 10 	movl   $0xc010af69,0xc(%esp)
c0104361:	c0 
c0104362:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104369:	c0 
c010436a:	c7 44 24 04 83 00 00 	movl   $0x83,0x4(%esp)
c0104371:	00 
c0104372:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104379:	e8 bf c0 ff ff       	call   c010043d <__panic>
     }
     cprintf("swap_in: load disk swap entry %d with swap_page in vadr 0x%x\n", (*ptep)>>8, addr);
c010437e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104381:	8b 00                	mov    (%eax),%eax
c0104383:	c1 e8 08             	shr    $0x8,%eax
c0104386:	89 c2                	mov    %eax,%edx
c0104388:	8b 45 0c             	mov    0xc(%ebp),%eax
c010438b:	89 44 24 08          	mov    %eax,0x8(%esp)
c010438f:	89 54 24 04          	mov    %edx,0x4(%esp)
c0104393:	c7 04 24 70 af 10 c0 	movl   $0xc010af70,(%esp)
c010439a:	e8 32 bf ff ff       	call   c01002d1 <cprintf>
     *ptr_result=result;
c010439f:	8b 45 10             	mov    0x10(%ebp),%eax
c01043a2:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01043a5:	89 10                	mov    %edx,(%eax)
     return 0;
c01043a7:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01043ac:	c9                   	leave  
c01043ad:	c3                   	ret    

c01043ae <check_content_set>:



static inline void
check_content_set(void)
{
c01043ae:	55                   	push   %ebp
c01043af:	89 e5                	mov    %esp,%ebp
c01043b1:	83 ec 18             	sub    $0x18,%esp
     *(unsigned char *)0x1000 = 0x0a;
c01043b4:	b8 00 10 00 00       	mov    $0x1000,%eax
c01043b9:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c01043bc:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01043c1:	83 f8 01             	cmp    $0x1,%eax
c01043c4:	74 24                	je     c01043ea <check_content_set+0x3c>
c01043c6:	c7 44 24 0c ae af 10 	movl   $0xc010afae,0xc(%esp)
c01043cd:	c0 
c01043ce:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01043d5:	c0 
c01043d6:	c7 44 24 04 90 00 00 	movl   $0x90,0x4(%esp)
c01043dd:	00 
c01043de:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c01043e5:	e8 53 c0 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x1010 = 0x0a;
c01043ea:	b8 10 10 00 00       	mov    $0x1010,%eax
c01043ef:	c6 00 0a             	movb   $0xa,(%eax)
     assert(pgfault_num==1);
c01043f2:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01043f7:	83 f8 01             	cmp    $0x1,%eax
c01043fa:	74 24                	je     c0104420 <check_content_set+0x72>
c01043fc:	c7 44 24 0c ae af 10 	movl   $0xc010afae,0xc(%esp)
c0104403:	c0 
c0104404:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c010440b:	c0 
c010440c:	c7 44 24 04 92 00 00 	movl   $0x92,0x4(%esp)
c0104413:	00 
c0104414:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c010441b:	e8 1d c0 ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x2000 = 0x0b;
c0104420:	b8 00 20 00 00       	mov    $0x2000,%eax
c0104425:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c0104428:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c010442d:	83 f8 02             	cmp    $0x2,%eax
c0104430:	74 24                	je     c0104456 <check_content_set+0xa8>
c0104432:	c7 44 24 0c bd af 10 	movl   $0xc010afbd,0xc(%esp)
c0104439:	c0 
c010443a:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104441:	c0 
c0104442:	c7 44 24 04 94 00 00 	movl   $0x94,0x4(%esp)
c0104449:	00 
c010444a:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104451:	e8 e7 bf ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x2010 = 0x0b;
c0104456:	b8 10 20 00 00       	mov    $0x2010,%eax
c010445b:	c6 00 0b             	movb   $0xb,(%eax)
     assert(pgfault_num==2);
c010445e:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c0104463:	83 f8 02             	cmp    $0x2,%eax
c0104466:	74 24                	je     c010448c <check_content_set+0xde>
c0104468:	c7 44 24 0c bd af 10 	movl   $0xc010afbd,0xc(%esp)
c010446f:	c0 
c0104470:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104477:	c0 
c0104478:	c7 44 24 04 96 00 00 	movl   $0x96,0x4(%esp)
c010447f:	00 
c0104480:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104487:	e8 b1 bf ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x3000 = 0x0c;
c010448c:	b8 00 30 00 00       	mov    $0x3000,%eax
c0104491:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c0104494:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c0104499:	83 f8 03             	cmp    $0x3,%eax
c010449c:	74 24                	je     c01044c2 <check_content_set+0x114>
c010449e:	c7 44 24 0c cc af 10 	movl   $0xc010afcc,0xc(%esp)
c01044a5:	c0 
c01044a6:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01044ad:	c0 
c01044ae:	c7 44 24 04 98 00 00 	movl   $0x98,0x4(%esp)
c01044b5:	00 
c01044b6:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c01044bd:	e8 7b bf ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x3010 = 0x0c;
c01044c2:	b8 10 30 00 00       	mov    $0x3010,%eax
c01044c7:	c6 00 0c             	movb   $0xc,(%eax)
     assert(pgfault_num==3);
c01044ca:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01044cf:	83 f8 03             	cmp    $0x3,%eax
c01044d2:	74 24                	je     c01044f8 <check_content_set+0x14a>
c01044d4:	c7 44 24 0c cc af 10 	movl   $0xc010afcc,0xc(%esp)
c01044db:	c0 
c01044dc:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01044e3:	c0 
c01044e4:	c7 44 24 04 9a 00 00 	movl   $0x9a,0x4(%esp)
c01044eb:	00 
c01044ec:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c01044f3:	e8 45 bf ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x4000 = 0x0d;
c01044f8:	b8 00 40 00 00       	mov    $0x4000,%eax
c01044fd:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c0104500:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c0104505:	83 f8 04             	cmp    $0x4,%eax
c0104508:	74 24                	je     c010452e <check_content_set+0x180>
c010450a:	c7 44 24 0c db af 10 	movl   $0xc010afdb,0xc(%esp)
c0104511:	c0 
c0104512:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104519:	c0 
c010451a:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
c0104521:	00 
c0104522:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104529:	e8 0f bf ff ff       	call   c010043d <__panic>
     *(unsigned char *)0x4010 = 0x0d;
c010452e:	b8 10 40 00 00       	mov    $0x4010,%eax
c0104533:	c6 00 0d             	movb   $0xd,(%eax)
     assert(pgfault_num==4);
c0104536:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c010453b:	83 f8 04             	cmp    $0x4,%eax
c010453e:	74 24                	je     c0104564 <check_content_set+0x1b6>
c0104540:	c7 44 24 0c db af 10 	movl   $0xc010afdb,0xc(%esp)
c0104547:	c0 
c0104548:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c010454f:	c0 
c0104550:	c7 44 24 04 9e 00 00 	movl   $0x9e,0x4(%esp)
c0104557:	00 
c0104558:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c010455f:	e8 d9 be ff ff       	call   c010043d <__panic>
}
c0104564:	90                   	nop
c0104565:	c9                   	leave  
c0104566:	c3                   	ret    

c0104567 <check_content_access>:

static inline int
check_content_access(void)
{
c0104567:	55                   	push   %ebp
c0104568:	89 e5                	mov    %esp,%ebp
c010456a:	83 ec 18             	sub    $0x18,%esp
    int ret = sm->check_swap();
c010456d:	a1 70 bf 12 c0       	mov    0xc012bf70,%eax
c0104572:	8b 40 1c             	mov    0x1c(%eax),%eax
c0104575:	ff d0                	call   *%eax
c0104577:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return ret;
c010457a:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c010457d:	c9                   	leave  
c010457e:	c3                   	ret    

c010457f <check_swap>:
#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
check_swap(void)
{
c010457f:	f3 0f 1e fb          	endbr32 
c0104583:	55                   	push   %ebp
c0104584:	89 e5                	mov    %esp,%ebp
c0104586:	83 ec 78             	sub    $0x78,%esp
    //backup mem env
     int ret, count = 0, total = 0, i;
c0104589:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0104590:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
     list_entry_t *le = &free_list;
c0104597:	c7 45 e8 2c e1 12 c0 	movl   $0xc012e12c,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c010459e:	eb 6a                	jmp    c010460a <check_swap+0x8b>
        struct Page *p = le2page(le, page_link);
c01045a0:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01045a3:	83 e8 0c             	sub    $0xc,%eax
c01045a6:	89 45 c8             	mov    %eax,-0x38(%ebp)
        assert(PageProperty(p));
c01045a9:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01045ac:	83 c0 04             	add    $0x4,%eax
c01045af:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
c01045b6:	89 45 c0             	mov    %eax,-0x40(%ebp)
 * @addr:   the address to count from
 * */
static inline bool
test_bit(int nr, volatile void *addr) {
    int oldbit;
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01045b9:	8b 45 c0             	mov    -0x40(%ebp),%eax
c01045bc:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c01045bf:	0f a3 10             	bt     %edx,(%eax)
c01045c2:	19 c0                	sbb    %eax,%eax
c01045c4:	89 45 bc             	mov    %eax,-0x44(%ebp)
    return oldbit != 0;
c01045c7:	83 7d bc 00          	cmpl   $0x0,-0x44(%ebp)
c01045cb:	0f 95 c0             	setne  %al
c01045ce:	0f b6 c0             	movzbl %al,%eax
c01045d1:	85 c0                	test   %eax,%eax
c01045d3:	75 24                	jne    c01045f9 <check_swap+0x7a>
c01045d5:	c7 44 24 0c ea af 10 	movl   $0xc010afea,0xc(%esp)
c01045dc:	c0 
c01045dd:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01045e4:	c0 
c01045e5:	c7 44 24 04 b9 00 00 	movl   $0xb9,0x4(%esp)
c01045ec:	00 
c01045ed:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c01045f4:	e8 44 be ff ff       	call   c010043d <__panic>
        count ++, total += p->property;
c01045f9:	ff 45 f4             	incl   -0xc(%ebp)
c01045fc:	8b 45 c8             	mov    -0x38(%ebp),%eax
c01045ff:	8b 50 08             	mov    0x8(%eax),%edx
c0104602:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104605:	01 d0                	add    %edx,%eax
c0104607:	89 45 f0             	mov    %eax,-0x10(%ebp)
c010460a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010460d:	89 45 b8             	mov    %eax,-0x48(%ebp)
c0104610:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0104613:	8b 40 04             	mov    0x4(%eax),%eax
     while ((le = list_next(le)) != &free_list) {
c0104616:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0104619:	81 7d e8 2c e1 12 c0 	cmpl   $0xc012e12c,-0x18(%ebp)
c0104620:	0f 85 7a ff ff ff    	jne    c01045a0 <check_swap+0x21>
     }
     assert(total == nr_free_pages());
c0104626:	e8 79 28 00 00       	call   c0106ea4 <nr_free_pages>
c010462b:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010462e:	39 d0                	cmp    %edx,%eax
c0104630:	74 24                	je     c0104656 <check_swap+0xd7>
c0104632:	c7 44 24 0c fa af 10 	movl   $0xc010affa,0xc(%esp)
c0104639:	c0 
c010463a:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104641:	c0 
c0104642:	c7 44 24 04 bc 00 00 	movl   $0xbc,0x4(%esp)
c0104649:	00 
c010464a:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104651:	e8 e7 bd ff ff       	call   c010043d <__panic>
     cprintf("BEGIN check_swap: count %d, total %d\n",count,total);
c0104656:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104659:	89 44 24 08          	mov    %eax,0x8(%esp)
c010465d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104660:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104664:	c7 04 24 14 b0 10 c0 	movl   $0xc010b014,(%esp)
c010466b:	e8 61 bc ff ff       	call   c01002d1 <cprintf>
     
     //now we set the phy pages env     
     struct mm_struct *mm = mm_create();
c0104670:	e8 4a ec ff ff       	call   c01032bf <mm_create>
c0104675:	89 45 e4             	mov    %eax,-0x1c(%ebp)
     assert(mm != NULL);
c0104678:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c010467c:	75 24                	jne    c01046a2 <check_swap+0x123>
c010467e:	c7 44 24 0c 3a b0 10 	movl   $0xc010b03a,0xc(%esp)
c0104685:	c0 
c0104686:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c010468d:	c0 
c010468e:	c7 44 24 04 c1 00 00 	movl   $0xc1,0x4(%esp)
c0104695:	00 
c0104696:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c010469d:	e8 9b bd ff ff       	call   c010043d <__panic>

     extern struct mm_struct *check_mm_struct;
     assert(check_mm_struct == NULL);
c01046a2:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c01046a7:	85 c0                	test   %eax,%eax
c01046a9:	74 24                	je     c01046cf <check_swap+0x150>
c01046ab:	c7 44 24 0c 45 b0 10 	movl   $0xc010b045,0xc(%esp)
c01046b2:	c0 
c01046b3:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01046ba:	c0 
c01046bb:	c7 44 24 04 c4 00 00 	movl   $0xc4,0x4(%esp)
c01046c2:	00 
c01046c3:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c01046ca:	e8 6e bd ff ff       	call   c010043d <__panic>

     check_mm_struct = mm;
c01046cf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01046d2:	a3 58 e0 12 c0       	mov    %eax,0xc012e058

     pde_t *pgdir = mm->pgdir = boot_pgdir;
c01046d7:	8b 15 20 8a 12 c0    	mov    0xc0128a20,%edx
c01046dd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01046e0:	89 50 0c             	mov    %edx,0xc(%eax)
c01046e3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01046e6:	8b 40 0c             	mov    0xc(%eax),%eax
c01046e9:	89 45 e0             	mov    %eax,-0x20(%ebp)
     assert(pgdir[0] == 0);
c01046ec:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01046ef:	8b 00                	mov    (%eax),%eax
c01046f1:	85 c0                	test   %eax,%eax
c01046f3:	74 24                	je     c0104719 <check_swap+0x19a>
c01046f5:	c7 44 24 0c 5d b0 10 	movl   $0xc010b05d,0xc(%esp)
c01046fc:	c0 
c01046fd:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104704:	c0 
c0104705:	c7 44 24 04 c9 00 00 	movl   $0xc9,0x4(%esp)
c010470c:	00 
c010470d:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104714:	e8 24 bd ff ff       	call   c010043d <__panic>

     struct vma_struct *vma = vma_create(BEING_CHECK_VALID_VADDR, CHECK_VALID_VADDR, VM_WRITE | VM_READ);
c0104719:	c7 44 24 08 03 00 00 	movl   $0x3,0x8(%esp)
c0104720:	00 
c0104721:	c7 44 24 04 00 60 00 	movl   $0x6000,0x4(%esp)
c0104728:	00 
c0104729:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
c0104730:	e8 07 ec ff ff       	call   c010333c <vma_create>
c0104735:	89 45 dc             	mov    %eax,-0x24(%ebp)
     assert(vma != NULL);
c0104738:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c010473c:	75 24                	jne    c0104762 <check_swap+0x1e3>
c010473e:	c7 44 24 0c 6b b0 10 	movl   $0xc010b06b,0xc(%esp)
c0104745:	c0 
c0104746:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c010474d:	c0 
c010474e:	c7 44 24 04 cc 00 00 	movl   $0xcc,0x4(%esp)
c0104755:	00 
c0104756:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c010475d:	e8 db bc ff ff       	call   c010043d <__panic>

     insert_vma_struct(mm, vma);
c0104762:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0104765:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104769:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010476c:	89 04 24             	mov    %eax,(%esp)
c010476f:	e8 61 ed ff ff       	call   c01034d5 <insert_vma_struct>

     //setup the temp Page Table vaddr 0~4MB
     cprintf("setup Page Table for vaddr 0X1000, so alloc a page\n");
c0104774:	c7 04 24 78 b0 10 c0 	movl   $0xc010b078,(%esp)
c010477b:	e8 51 bb ff ff       	call   c01002d1 <cprintf>
     pte_t *temp_ptep=NULL;
c0104780:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)
     temp_ptep = get_pte(mm->pgdir, BEING_CHECK_VALID_VADDR, 1);
c0104787:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010478a:	8b 40 0c             	mov    0xc(%eax),%eax
c010478d:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0104794:	00 
c0104795:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c010479c:	00 
c010479d:	89 04 24             	mov    %eax,(%esp)
c01047a0:	e8 29 2d 00 00       	call   c01074ce <get_pte>
c01047a5:	89 45 d8             	mov    %eax,-0x28(%ebp)
     assert(temp_ptep!= NULL);
c01047a8:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c01047ac:	75 24                	jne    c01047d2 <check_swap+0x253>
c01047ae:	c7 44 24 0c ac b0 10 	movl   $0xc010b0ac,0xc(%esp)
c01047b5:	c0 
c01047b6:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01047bd:	c0 
c01047be:	c7 44 24 04 d4 00 00 	movl   $0xd4,0x4(%esp)
c01047c5:	00 
c01047c6:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c01047cd:	e8 6b bc ff ff       	call   c010043d <__panic>
     cprintf("setup Page Table vaddr 0~4MB OVER!\n");
c01047d2:	c7 04 24 c0 b0 10 c0 	movl   $0xc010b0c0,(%esp)
c01047d9:	e8 f3 ba ff ff       	call   c01002d1 <cprintf>
     
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c01047de:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01047e5:	e9 a2 00 00 00       	jmp    c010488c <check_swap+0x30d>
          check_rp[i] = alloc_page();
c01047ea:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01047f1:	e8 08 26 00 00       	call   c0106dfe <alloc_pages>
c01047f6:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01047f9:	89 04 95 60 e0 12 c0 	mov    %eax,-0x3fed1fa0(,%edx,4)
          assert(check_rp[i] != NULL );
c0104800:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104803:	8b 04 85 60 e0 12 c0 	mov    -0x3fed1fa0(,%eax,4),%eax
c010480a:	85 c0                	test   %eax,%eax
c010480c:	75 24                	jne    c0104832 <check_swap+0x2b3>
c010480e:	c7 44 24 0c e4 b0 10 	movl   $0xc010b0e4,0xc(%esp)
c0104815:	c0 
c0104816:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c010481d:	c0 
c010481e:	c7 44 24 04 d9 00 00 	movl   $0xd9,0x4(%esp)
c0104825:	00 
c0104826:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c010482d:	e8 0b bc ff ff       	call   c010043d <__panic>
          assert(!PageProperty(check_rp[i]));
c0104832:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104835:	8b 04 85 60 e0 12 c0 	mov    -0x3fed1fa0(,%eax,4),%eax
c010483c:	83 c0 04             	add    $0x4,%eax
c010483f:	c7 45 b4 01 00 00 00 	movl   $0x1,-0x4c(%ebp)
c0104846:	89 45 b0             	mov    %eax,-0x50(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0104849:	8b 45 b0             	mov    -0x50(%ebp),%eax
c010484c:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c010484f:	0f a3 10             	bt     %edx,(%eax)
c0104852:	19 c0                	sbb    %eax,%eax
c0104854:	89 45 ac             	mov    %eax,-0x54(%ebp)
    return oldbit != 0;
c0104857:	83 7d ac 00          	cmpl   $0x0,-0x54(%ebp)
c010485b:	0f 95 c0             	setne  %al
c010485e:	0f b6 c0             	movzbl %al,%eax
c0104861:	85 c0                	test   %eax,%eax
c0104863:	74 24                	je     c0104889 <check_swap+0x30a>
c0104865:	c7 44 24 0c f8 b0 10 	movl   $0xc010b0f8,0xc(%esp)
c010486c:	c0 
c010486d:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104874:	c0 
c0104875:	c7 44 24 04 da 00 00 	movl   $0xda,0x4(%esp)
c010487c:	00 
c010487d:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104884:	e8 b4 bb ff ff       	call   c010043d <__panic>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0104889:	ff 45 ec             	incl   -0x14(%ebp)
c010488c:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0104890:	0f 8e 54 ff ff ff    	jle    c01047ea <check_swap+0x26b>
     }
     list_entry_t free_list_store = free_list;
c0104896:	a1 2c e1 12 c0       	mov    0xc012e12c,%eax
c010489b:	8b 15 30 e1 12 c0    	mov    0xc012e130,%edx
c01048a1:	89 45 98             	mov    %eax,-0x68(%ebp)
c01048a4:	89 55 9c             	mov    %edx,-0x64(%ebp)
c01048a7:	c7 45 a4 2c e1 12 c0 	movl   $0xc012e12c,-0x5c(%ebp)
    elm->prev = elm->next = elm;
c01048ae:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c01048b1:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c01048b4:	89 50 04             	mov    %edx,0x4(%eax)
c01048b7:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c01048ba:	8b 50 04             	mov    0x4(%eax),%edx
c01048bd:	8b 45 a4             	mov    -0x5c(%ebp),%eax
c01048c0:	89 10                	mov    %edx,(%eax)
}
c01048c2:	90                   	nop
c01048c3:	c7 45 a8 2c e1 12 c0 	movl   $0xc012e12c,-0x58(%ebp)
    return list->next == list;
c01048ca:	8b 45 a8             	mov    -0x58(%ebp),%eax
c01048cd:	8b 40 04             	mov    0x4(%eax),%eax
c01048d0:	39 45 a8             	cmp    %eax,-0x58(%ebp)
c01048d3:	0f 94 c0             	sete   %al
c01048d6:	0f b6 c0             	movzbl %al,%eax
     list_init(&free_list);
     assert(list_empty(&free_list));
c01048d9:	85 c0                	test   %eax,%eax
c01048db:	75 24                	jne    c0104901 <check_swap+0x382>
c01048dd:	c7 44 24 0c 13 b1 10 	movl   $0xc010b113,0xc(%esp)
c01048e4:	c0 
c01048e5:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01048ec:	c0 
c01048ed:	c7 44 24 04 de 00 00 	movl   $0xde,0x4(%esp)
c01048f4:	00 
c01048f5:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c01048fc:	e8 3c bb ff ff       	call   c010043d <__panic>
     
     //assert(alloc_page() == NULL);
     
     unsigned int nr_free_store = nr_free;
c0104901:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c0104906:	89 45 d4             	mov    %eax,-0x2c(%ebp)
     nr_free = 0;
c0104909:	c7 05 34 e1 12 c0 00 	movl   $0x0,0xc012e134
c0104910:	00 00 00 
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0104913:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c010491a:	eb 1d                	jmp    c0104939 <check_swap+0x3ba>
        free_pages(check_rp[i],1);
c010491c:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010491f:	8b 04 85 60 e0 12 c0 	mov    -0x3fed1fa0(,%eax,4),%eax
c0104926:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010492d:	00 
c010492e:	89 04 24             	mov    %eax,(%esp)
c0104931:	e8 37 25 00 00       	call   c0106e6d <free_pages>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0104936:	ff 45 ec             	incl   -0x14(%ebp)
c0104939:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c010493d:	7e dd                	jle    c010491c <check_swap+0x39d>
     }
     assert(nr_free==CHECK_VALID_PHY_PAGE_NUM);
c010493f:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c0104944:	83 f8 04             	cmp    $0x4,%eax
c0104947:	74 24                	je     c010496d <check_swap+0x3ee>
c0104949:	c7 44 24 0c 2c b1 10 	movl   $0xc010b12c,0xc(%esp)
c0104950:	c0 
c0104951:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104958:	c0 
c0104959:	c7 44 24 04 e7 00 00 	movl   $0xe7,0x4(%esp)
c0104960:	00 
c0104961:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104968:	e8 d0 ba ff ff       	call   c010043d <__panic>
     
     cprintf("set up init env for check_swap begin!\n");
c010496d:	c7 04 24 50 b1 10 c0 	movl   $0xc010b150,(%esp)
c0104974:	e8 58 b9 ff ff       	call   c01002d1 <cprintf>
     //setup initial vir_page<->phy_page environment for page relpacement algorithm 

     
     pgfault_num=0;
c0104979:	c7 05 64 bf 12 c0 00 	movl   $0x0,0xc012bf64
c0104980:	00 00 00 
     
     check_content_set();
c0104983:	e8 26 fa ff ff       	call   c01043ae <check_content_set>
     assert( nr_free == 0);         
c0104988:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c010498d:	85 c0                	test   %eax,%eax
c010498f:	74 24                	je     c01049b5 <check_swap+0x436>
c0104991:	c7 44 24 0c 77 b1 10 	movl   $0xc010b177,0xc(%esp)
c0104998:	c0 
c0104999:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c01049a0:	c0 
c01049a1:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
c01049a8:	00 
c01049a9:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c01049b0:	e8 88 ba ff ff       	call   c010043d <__panic>
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c01049b5:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01049bc:	eb 25                	jmp    c01049e3 <check_swap+0x464>
         swap_out_seq_no[i]=swap_in_seq_no[i]=-1;
c01049be:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01049c1:	c7 04 85 80 e0 12 c0 	movl   $0xffffffff,-0x3fed1f80(,%eax,4)
c01049c8:	ff ff ff ff 
c01049cc:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01049cf:	8b 14 85 80 e0 12 c0 	mov    -0x3fed1f80(,%eax,4),%edx
c01049d6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01049d9:	89 14 85 c0 e0 12 c0 	mov    %edx,-0x3fed1f40(,%eax,4)
     for(i = 0; i<MAX_SEQ_NO ; i++) 
c01049e0:	ff 45 ec             	incl   -0x14(%ebp)
c01049e3:	83 7d ec 09          	cmpl   $0x9,-0x14(%ebp)
c01049e7:	7e d5                	jle    c01049be <check_swap+0x43f>
     
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c01049e9:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c01049f0:	e9 e8 00 00 00       	jmp    c0104add <check_swap+0x55e>
         check_ptep[i]=0;
c01049f5:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01049f8:	c7 04 85 14 e1 12 c0 	movl   $0x0,-0x3fed1eec(,%eax,4)
c01049ff:	00 00 00 00 
         check_ptep[i] = get_pte(pgdir, (i+1)*0x1000, 0);
c0104a03:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104a06:	40                   	inc    %eax
c0104a07:	c1 e0 0c             	shl    $0xc,%eax
c0104a0a:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0104a11:	00 
c0104a12:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104a16:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104a19:	89 04 24             	mov    %eax,(%esp)
c0104a1c:	e8 ad 2a 00 00       	call   c01074ce <get_pte>
c0104a21:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104a24:	89 04 95 14 e1 12 c0 	mov    %eax,-0x3fed1eec(,%edx,4)
         //cprintf("i %d, check_ptep addr %x, value %x\n", i, check_ptep[i], *check_ptep[i]);
         assert(check_ptep[i] != NULL);
c0104a2b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104a2e:	8b 04 85 14 e1 12 c0 	mov    -0x3fed1eec(,%eax,4),%eax
c0104a35:	85 c0                	test   %eax,%eax
c0104a37:	75 24                	jne    c0104a5d <check_swap+0x4de>
c0104a39:	c7 44 24 0c 84 b1 10 	movl   $0xc010b184,0xc(%esp)
c0104a40:	c0 
c0104a41:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104a48:	c0 
c0104a49:	c7 44 24 04 f8 00 00 	movl   $0xf8,0x4(%esp)
c0104a50:	00 
c0104a51:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104a58:	e8 e0 b9 ff ff       	call   c010043d <__panic>
         assert(pte2page(*check_ptep[i]) == check_rp[i]);
c0104a5d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104a60:	8b 04 85 14 e1 12 c0 	mov    -0x3fed1eec(,%eax,4),%eax
c0104a67:	8b 00                	mov    (%eax),%eax
c0104a69:	89 04 24             	mov    %eax,(%esp)
c0104a6c:	e8 8b f5 ff ff       	call   c0103ffc <pte2page>
c0104a71:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104a74:	8b 14 95 60 e0 12 c0 	mov    -0x3fed1fa0(,%edx,4),%edx
c0104a7b:	39 d0                	cmp    %edx,%eax
c0104a7d:	74 24                	je     c0104aa3 <check_swap+0x524>
c0104a7f:	c7 44 24 0c 9c b1 10 	movl   $0xc010b19c,0xc(%esp)
c0104a86:	c0 
c0104a87:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104a8e:	c0 
c0104a8f:	c7 44 24 04 f9 00 00 	movl   $0xf9,0x4(%esp)
c0104a96:	00 
c0104a97:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104a9e:	e8 9a b9 ff ff       	call   c010043d <__panic>
         assert((*check_ptep[i] & PTE_P));          
c0104aa3:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104aa6:	8b 04 85 14 e1 12 c0 	mov    -0x3fed1eec(,%eax,4),%eax
c0104aad:	8b 00                	mov    (%eax),%eax
c0104aaf:	83 e0 01             	and    $0x1,%eax
c0104ab2:	85 c0                	test   %eax,%eax
c0104ab4:	75 24                	jne    c0104ada <check_swap+0x55b>
c0104ab6:	c7 44 24 0c c4 b1 10 	movl   $0xc010b1c4,0xc(%esp)
c0104abd:	c0 
c0104abe:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104ac5:	c0 
c0104ac6:	c7 44 24 04 fa 00 00 	movl   $0xfa,0x4(%esp)
c0104acd:	00 
c0104ace:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104ad5:	e8 63 b9 ff ff       	call   c010043d <__panic>
     for (i= 0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0104ada:	ff 45 ec             	incl   -0x14(%ebp)
c0104add:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0104ae1:	0f 8e 0e ff ff ff    	jle    c01049f5 <check_swap+0x476>
     }
     cprintf("set up init env for check_swap over!\n");
c0104ae7:	c7 04 24 e0 b1 10 c0 	movl   $0xc010b1e0,(%esp)
c0104aee:	e8 de b7 ff ff       	call   c01002d1 <cprintf>
     // now access the virt pages to test  page relpacement algorithm 
     ret=check_content_access();
c0104af3:	e8 6f fa ff ff       	call   c0104567 <check_content_access>
c0104af8:	89 45 d0             	mov    %eax,-0x30(%ebp)
     assert(ret==0);
c0104afb:	83 7d d0 00          	cmpl   $0x0,-0x30(%ebp)
c0104aff:	74 24                	je     c0104b25 <check_swap+0x5a6>
c0104b01:	c7 44 24 0c 06 b2 10 	movl   $0xc010b206,0xc(%esp)
c0104b08:	c0 
c0104b09:	c7 44 24 08 ee ae 10 	movl   $0xc010aeee,0x8(%esp)
c0104b10:	c0 
c0104b11:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
c0104b18:	00 
c0104b19:	c7 04 24 88 ae 10 c0 	movl   $0xc010ae88,(%esp)
c0104b20:	e8 18 b9 ff ff       	call   c010043d <__panic>
     
     //restore kernel mem env
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0104b25:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0104b2c:	eb 1d                	jmp    c0104b4b <check_swap+0x5cc>
         free_pages(check_rp[i],1);
c0104b2e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104b31:	8b 04 85 60 e0 12 c0 	mov    -0x3fed1fa0(,%eax,4),%eax
c0104b38:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0104b3f:	00 
c0104b40:	89 04 24             	mov    %eax,(%esp)
c0104b43:	e8 25 23 00 00       	call   c0106e6d <free_pages>
     for (i=0;i<CHECK_VALID_PHY_PAGE_NUM;i++) {
c0104b48:	ff 45 ec             	incl   -0x14(%ebp)
c0104b4b:	83 7d ec 03          	cmpl   $0x3,-0x14(%ebp)
c0104b4f:	7e dd                	jle    c0104b2e <check_swap+0x5af>
     } 

     //free_page(pte2page(*temp_ptep));
     
     mm_destroy(mm);
c0104b51:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104b54:	89 04 24             	mov    %eax,(%esp)
c0104b57:	e8 b1 ea ff ff       	call   c010360d <mm_destroy>
         
     nr_free = nr_free_store;
c0104b5c:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0104b5f:	a3 34 e1 12 c0       	mov    %eax,0xc012e134
     free_list = free_list_store;
c0104b64:	8b 45 98             	mov    -0x68(%ebp),%eax
c0104b67:	8b 55 9c             	mov    -0x64(%ebp),%edx
c0104b6a:	a3 2c e1 12 c0       	mov    %eax,0xc012e12c
c0104b6f:	89 15 30 e1 12 c0    	mov    %edx,0xc012e130

     
     le = &free_list;
c0104b75:	c7 45 e8 2c e1 12 c0 	movl   $0xc012e12c,-0x18(%ebp)
     while ((le = list_next(le)) != &free_list) {
c0104b7c:	eb 1c                	jmp    c0104b9a <check_swap+0x61b>
         struct Page *p = le2page(le, page_link);
c0104b7e:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104b81:	83 e8 0c             	sub    $0xc,%eax
c0104b84:	89 45 cc             	mov    %eax,-0x34(%ebp)
         count --, total -= p->property;
c0104b87:	ff 4d f4             	decl   -0xc(%ebp)
c0104b8a:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0104b8d:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0104b90:	8b 40 08             	mov    0x8(%eax),%eax
c0104b93:	29 c2                	sub    %eax,%edx
c0104b95:	89 d0                	mov    %edx,%eax
c0104b97:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104b9a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0104b9d:	89 45 a0             	mov    %eax,-0x60(%ebp)
    return listelm->next;
c0104ba0:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0104ba3:	8b 40 04             	mov    0x4(%eax),%eax
     while ((le = list_next(le)) != &free_list) {
c0104ba6:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0104ba9:	81 7d e8 2c e1 12 c0 	cmpl   $0xc012e12c,-0x18(%ebp)
c0104bb0:	75 cc                	jne    c0104b7e <check_swap+0x5ff>
     }
     cprintf("count is %d, total is %d\n",count,total);
c0104bb2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104bb5:	89 44 24 08          	mov    %eax,0x8(%esp)
c0104bb9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104bbc:	89 44 24 04          	mov    %eax,0x4(%esp)
c0104bc0:	c7 04 24 0d b2 10 c0 	movl   $0xc010b20d,(%esp)
c0104bc7:	e8 05 b7 ff ff       	call   c01002d1 <cprintf>
     //assert(count == 0);
     
     cprintf("check_swap() succeeded!\n");
c0104bcc:	c7 04 24 27 b2 10 c0 	movl   $0xc010b227,(%esp)
c0104bd3:	e8 f9 b6 ff ff       	call   c01002d1 <cprintf>
}
c0104bd8:	90                   	nop
c0104bd9:	c9                   	leave  
c0104bda:	c3                   	ret    

c0104bdb <__intr_save>:
__intr_save(void) {
c0104bdb:	55                   	push   %ebp
c0104bdc:	89 e5                	mov    %esp,%ebp
c0104bde:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0104be1:	9c                   	pushf  
c0104be2:	58                   	pop    %eax
c0104be3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0104be6:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0104be9:	25 00 02 00 00       	and    $0x200,%eax
c0104bee:	85 c0                	test   %eax,%eax
c0104bf0:	74 0c                	je     c0104bfe <__intr_save+0x23>
        intr_disable();
c0104bf2:	e8 57 d5 ff ff       	call   c010214e <intr_disable>
        return 1;
c0104bf7:	b8 01 00 00 00       	mov    $0x1,%eax
c0104bfc:	eb 05                	jmp    c0104c03 <__intr_save+0x28>
    return 0;
c0104bfe:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0104c03:	c9                   	leave  
c0104c04:	c3                   	ret    

c0104c05 <__intr_restore>:
__intr_restore(bool flag) {
c0104c05:	55                   	push   %ebp
c0104c06:	89 e5                	mov    %esp,%ebp
c0104c08:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0104c0b:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0104c0f:	74 05                	je     c0104c16 <__intr_restore+0x11>
        intr_enable();
c0104c11:	e8 2c d5 ff ff       	call   c0102142 <intr_enable>
}
c0104c16:	90                   	nop
c0104c17:	c9                   	leave  
c0104c18:	c3                   	ret    

c0104c19 <page2ppn>:
page2ppn(struct Page *page) {
c0104c19:	55                   	push   %ebp
c0104c1a:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0104c1c:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c0104c21:	8b 55 08             	mov    0x8(%ebp),%edx
c0104c24:	29 c2                	sub    %eax,%edx
c0104c26:	89 d0                	mov    %edx,%eax
c0104c28:	c1 f8 05             	sar    $0x5,%eax
}
c0104c2b:	5d                   	pop    %ebp
c0104c2c:	c3                   	ret    

c0104c2d <page2pa>:
page2pa(struct Page *page) {
c0104c2d:	55                   	push   %ebp
c0104c2e:	89 e5                	mov    %esp,%ebp
c0104c30:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0104c33:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c36:	89 04 24             	mov    %eax,(%esp)
c0104c39:	e8 db ff ff ff       	call   c0104c19 <page2ppn>
c0104c3e:	c1 e0 0c             	shl    $0xc,%eax
}
c0104c41:	c9                   	leave  
c0104c42:	c3                   	ret    

c0104c43 <pa2page>:
pa2page(uintptr_t pa) {
c0104c43:	55                   	push   %ebp
c0104c44:	89 e5                	mov    %esp,%ebp
c0104c46:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0104c49:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c4c:	c1 e8 0c             	shr    $0xc,%eax
c0104c4f:	89 c2                	mov    %eax,%edx
c0104c51:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0104c56:	39 c2                	cmp    %eax,%edx
c0104c58:	72 1c                	jb     c0104c76 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0104c5a:	c7 44 24 08 40 b2 10 	movl   $0xc010b240,0x8(%esp)
c0104c61:	c0 
c0104c62:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0104c69:	00 
c0104c6a:	c7 04 24 5f b2 10 c0 	movl   $0xc010b25f,(%esp)
c0104c71:	e8 c7 b7 ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0104c76:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c0104c7b:	8b 55 08             	mov    0x8(%ebp),%edx
c0104c7e:	c1 ea 0c             	shr    $0xc,%edx
c0104c81:	c1 e2 05             	shl    $0x5,%edx
c0104c84:	01 d0                	add    %edx,%eax
}
c0104c86:	c9                   	leave  
c0104c87:	c3                   	ret    

c0104c88 <page2kva>:
page2kva(struct Page *page) {
c0104c88:	55                   	push   %ebp
c0104c89:	89 e5                	mov    %esp,%ebp
c0104c8b:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c0104c8e:	8b 45 08             	mov    0x8(%ebp),%eax
c0104c91:	89 04 24             	mov    %eax,(%esp)
c0104c94:	e8 94 ff ff ff       	call   c0104c2d <page2pa>
c0104c99:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104c9c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104c9f:	c1 e8 0c             	shr    $0xc,%eax
c0104ca2:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0104ca5:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0104caa:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0104cad:	72 23                	jb     c0104cd2 <page2kva+0x4a>
c0104caf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104cb2:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104cb6:	c7 44 24 08 70 b2 10 	movl   $0xc010b270,0x8(%esp)
c0104cbd:	c0 
c0104cbe:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0104cc5:	00 
c0104cc6:	c7 04 24 5f b2 10 c0 	movl   $0xc010b25f,(%esp)
c0104ccd:	e8 6b b7 ff ff       	call   c010043d <__panic>
c0104cd2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104cd5:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0104cda:	c9                   	leave  
c0104cdb:	c3                   	ret    

c0104cdc <kva2page>:
kva2page(void *kva) {
c0104cdc:	55                   	push   %ebp
c0104cdd:	89 e5                	mov    %esp,%ebp
c0104cdf:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c0104ce2:	8b 45 08             	mov    0x8(%ebp),%eax
c0104ce5:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104ce8:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c0104cef:	77 23                	ja     c0104d14 <kva2page+0x38>
c0104cf1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104cf4:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0104cf8:	c7 44 24 08 94 b2 10 	movl   $0xc010b294,0x8(%esp)
c0104cff:	c0 
c0104d00:	c7 44 24 04 6b 00 00 	movl   $0x6b,0x4(%esp)
c0104d07:	00 
c0104d08:	c7 04 24 5f b2 10 c0 	movl   $0xc010b25f,(%esp)
c0104d0f:	e8 29 b7 ff ff       	call   c010043d <__panic>
c0104d14:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104d17:	05 00 00 00 40       	add    $0x40000000,%eax
c0104d1c:	89 04 24             	mov    %eax,(%esp)
c0104d1f:	e8 1f ff ff ff       	call   c0104c43 <pa2page>
}
c0104d24:	c9                   	leave  
c0104d25:	c3                   	ret    

c0104d26 <__slob_get_free_pages>:
static slob_t *slobfree = &arena;
static bigblock_t *bigblocks;


static void* __slob_get_free_pages(gfp_t gfp, int order)
{
c0104d26:	f3 0f 1e fb          	endbr32 
c0104d2a:	55                   	push   %ebp
c0104d2b:	89 e5                	mov    %esp,%ebp
c0104d2d:	83 ec 28             	sub    $0x28,%esp
  struct Page * page = alloc_pages(1 << order);
c0104d30:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104d33:	ba 01 00 00 00       	mov    $0x1,%edx
c0104d38:	88 c1                	mov    %al,%cl
c0104d3a:	d3 e2                	shl    %cl,%edx
c0104d3c:	89 d0                	mov    %edx,%eax
c0104d3e:	89 04 24             	mov    %eax,(%esp)
c0104d41:	e8 b8 20 00 00       	call   c0106dfe <alloc_pages>
c0104d46:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(!page)
c0104d49:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0104d4d:	75 07                	jne    c0104d56 <__slob_get_free_pages+0x30>
    return NULL;
c0104d4f:	b8 00 00 00 00       	mov    $0x0,%eax
c0104d54:	eb 0b                	jmp    c0104d61 <__slob_get_free_pages+0x3b>
  return page2kva(page);
c0104d56:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104d59:	89 04 24             	mov    %eax,(%esp)
c0104d5c:	e8 27 ff ff ff       	call   c0104c88 <page2kva>
}
c0104d61:	c9                   	leave  
c0104d62:	c3                   	ret    

c0104d63 <__slob_free_pages>:

#define __slob_get_free_page(gfp) __slob_get_free_pages(gfp, 0)

static inline void __slob_free_pages(unsigned long kva, int order)
{
c0104d63:	55                   	push   %ebp
c0104d64:	89 e5                	mov    %esp,%ebp
c0104d66:	53                   	push   %ebx
c0104d67:	83 ec 14             	sub    $0x14,%esp
  free_pages(kva2page(kva), 1 << order);
c0104d6a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104d6d:	ba 01 00 00 00       	mov    $0x1,%edx
c0104d72:	88 c1                	mov    %al,%cl
c0104d74:	d3 e2                	shl    %cl,%edx
c0104d76:	89 d0                	mov    %edx,%eax
c0104d78:	89 c3                	mov    %eax,%ebx
c0104d7a:	8b 45 08             	mov    0x8(%ebp),%eax
c0104d7d:	89 04 24             	mov    %eax,(%esp)
c0104d80:	e8 57 ff ff ff       	call   c0104cdc <kva2page>
c0104d85:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0104d89:	89 04 24             	mov    %eax,(%esp)
c0104d8c:	e8 dc 20 00 00       	call   c0106e6d <free_pages>
}
c0104d91:	90                   	nop
c0104d92:	83 c4 14             	add    $0x14,%esp
c0104d95:	5b                   	pop    %ebx
c0104d96:	5d                   	pop    %ebp
c0104d97:	c3                   	ret    

c0104d98 <slob_alloc>:

static void slob_free(void *b, int size);

static void *slob_alloc(size_t size, gfp_t gfp, int align)
{
c0104d98:	f3 0f 1e fb          	endbr32 
c0104d9c:	55                   	push   %ebp
c0104d9d:	89 e5                	mov    %esp,%ebp
c0104d9f:	83 ec 38             	sub    $0x38,%esp
  assert( (size + SLOB_UNIT) < PAGE_SIZE );
c0104da2:	8b 45 08             	mov    0x8(%ebp),%eax
c0104da5:	83 c0 08             	add    $0x8,%eax
c0104da8:	3d ff 0f 00 00       	cmp    $0xfff,%eax
c0104dad:	76 24                	jbe    c0104dd3 <slob_alloc+0x3b>
c0104daf:	c7 44 24 0c b8 b2 10 	movl   $0xc010b2b8,0xc(%esp)
c0104db6:	c0 
c0104db7:	c7 44 24 08 d7 b2 10 	movl   $0xc010b2d7,0x8(%esp)
c0104dbe:	c0 
c0104dbf:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c0104dc6:	00 
c0104dc7:	c7 04 24 ec b2 10 c0 	movl   $0xc010b2ec,(%esp)
c0104dce:	e8 6a b6 ff ff       	call   c010043d <__panic>

	slob_t *prev, *cur, *aligned = 0;
c0104dd3:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
	int delta = 0, units = SLOB_UNITS(size);
c0104dda:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
c0104de1:	8b 45 08             	mov    0x8(%ebp),%eax
c0104de4:	83 c0 07             	add    $0x7,%eax
c0104de7:	c1 e8 03             	shr    $0x3,%eax
c0104dea:	89 45 e0             	mov    %eax,-0x20(%ebp)
	unsigned long flags;

	spin_lock_irqsave(&slob_lock, flags);
c0104ded:	e8 e9 fd ff ff       	call   c0104bdb <__intr_save>
c0104df2:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	prev = slobfree;
c0104df5:	a1 e8 89 12 c0       	mov    0xc01289e8,%eax
c0104dfa:	89 45 f4             	mov    %eax,-0xc(%ebp)
	for (cur = prev->next; ; prev = cur, cur = cur->next) {
c0104dfd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104e00:	8b 40 04             	mov    0x4(%eax),%eax
c0104e03:	89 45 f0             	mov    %eax,-0x10(%ebp)
		if (align) {
c0104e06:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0104e0a:	74 21                	je     c0104e2d <slob_alloc+0x95>
			aligned = (slob_t *)ALIGN((unsigned long)cur, align);
c0104e0c:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0104e0f:	8b 45 10             	mov    0x10(%ebp),%eax
c0104e12:	01 d0                	add    %edx,%eax
c0104e14:	8d 50 ff             	lea    -0x1(%eax),%edx
c0104e17:	8b 45 10             	mov    0x10(%ebp),%eax
c0104e1a:	f7 d8                	neg    %eax
c0104e1c:	21 d0                	and    %edx,%eax
c0104e1e:	89 45 ec             	mov    %eax,-0x14(%ebp)
			delta = aligned - cur;
c0104e21:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104e24:	2b 45 f0             	sub    -0x10(%ebp),%eax
c0104e27:	c1 f8 03             	sar    $0x3,%eax
c0104e2a:	89 45 e8             	mov    %eax,-0x18(%ebp)
		}
		if (cur->units >= units + delta) { /* room enough? */
c0104e2d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e30:	8b 00                	mov    (%eax),%eax
c0104e32:	8b 4d e0             	mov    -0x20(%ebp),%ecx
c0104e35:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0104e38:	01 ca                	add    %ecx,%edx
c0104e3a:	39 d0                	cmp    %edx,%eax
c0104e3c:	0f 8c aa 00 00 00    	jl     c0104eec <slob_alloc+0x154>
			if (delta) { /* need to fragment head to align? */
c0104e42:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0104e46:	74 38                	je     c0104e80 <slob_alloc+0xe8>
				aligned->units = cur->units - delta;
c0104e48:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e4b:	8b 00                	mov    (%eax),%eax
c0104e4d:	2b 45 e8             	sub    -0x18(%ebp),%eax
c0104e50:	89 c2                	mov    %eax,%edx
c0104e52:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104e55:	89 10                	mov    %edx,(%eax)
				aligned->next = cur->next;
c0104e57:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e5a:	8b 50 04             	mov    0x4(%eax),%edx
c0104e5d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104e60:	89 50 04             	mov    %edx,0x4(%eax)
				cur->next = aligned;
c0104e63:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e66:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0104e69:	89 50 04             	mov    %edx,0x4(%eax)
				cur->units = delta;
c0104e6c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e6f:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0104e72:	89 10                	mov    %edx,(%eax)
				prev = cur;
c0104e74:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e77:	89 45 f4             	mov    %eax,-0xc(%ebp)
				cur = aligned;
c0104e7a:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0104e7d:	89 45 f0             	mov    %eax,-0x10(%ebp)
			}

			if (cur->units == units) /* exact fit? */
c0104e80:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e83:	8b 00                	mov    (%eax),%eax
c0104e85:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0104e88:	75 0e                	jne    c0104e98 <slob_alloc+0x100>
				prev->next = cur->next; /* unlink */
c0104e8a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104e8d:	8b 50 04             	mov    0x4(%eax),%edx
c0104e90:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104e93:	89 50 04             	mov    %edx,0x4(%eax)
c0104e96:	eb 3c                	jmp    c0104ed4 <slob_alloc+0x13c>
			else { /* fragment */
				prev->next = cur + units;
c0104e98:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0104e9b:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0104ea2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104ea5:	01 c2                	add    %eax,%edx
c0104ea7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104eaa:	89 50 04             	mov    %edx,0x4(%eax)
				prev->next->units = cur->units - units;
c0104ead:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104eb0:	8b 10                	mov    (%eax),%edx
c0104eb2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104eb5:	8b 40 04             	mov    0x4(%eax),%eax
c0104eb8:	2b 55 e0             	sub    -0x20(%ebp),%edx
c0104ebb:	89 10                	mov    %edx,(%eax)
				prev->next->next = cur->next;
c0104ebd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104ec0:	8b 40 04             	mov    0x4(%eax),%eax
c0104ec3:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0104ec6:	8b 52 04             	mov    0x4(%edx),%edx
c0104ec9:	89 50 04             	mov    %edx,0x4(%eax)
				cur->units = units;
c0104ecc:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104ecf:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0104ed2:	89 10                	mov    %edx,(%eax)
			}

			slobfree = prev;
c0104ed4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104ed7:	a3 e8 89 12 c0       	mov    %eax,0xc01289e8
			spin_unlock_irqrestore(&slob_lock, flags);
c0104edc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104edf:	89 04 24             	mov    %eax,(%esp)
c0104ee2:	e8 1e fd ff ff       	call   c0104c05 <__intr_restore>
			return cur;
c0104ee7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104eea:	eb 7f                	jmp    c0104f6b <slob_alloc+0x1d3>
		}
		if (cur == slobfree) {
c0104eec:	a1 e8 89 12 c0       	mov    0xc01289e8,%eax
c0104ef1:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0104ef4:	75 61                	jne    c0104f57 <slob_alloc+0x1bf>
			spin_unlock_irqrestore(&slob_lock, flags);
c0104ef6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0104ef9:	89 04 24             	mov    %eax,(%esp)
c0104efc:	e8 04 fd ff ff       	call   c0104c05 <__intr_restore>

			if (size == PAGE_SIZE) /* trying to shrink arena? */
c0104f01:	81 7d 08 00 10 00 00 	cmpl   $0x1000,0x8(%ebp)
c0104f08:	75 07                	jne    c0104f11 <slob_alloc+0x179>
				return 0;
c0104f0a:	b8 00 00 00 00       	mov    $0x0,%eax
c0104f0f:	eb 5a                	jmp    c0104f6b <slob_alloc+0x1d3>

			cur = (slob_t *)__slob_get_free_page(gfp);
c0104f11:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0104f18:	00 
c0104f19:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104f1c:	89 04 24             	mov    %eax,(%esp)
c0104f1f:	e8 02 fe ff ff       	call   c0104d26 <__slob_get_free_pages>
c0104f24:	89 45 f0             	mov    %eax,-0x10(%ebp)
			if (!cur)
c0104f27:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0104f2b:	75 07                	jne    c0104f34 <slob_alloc+0x19c>
				return 0;
c0104f2d:	b8 00 00 00 00       	mov    $0x0,%eax
c0104f32:	eb 37                	jmp    c0104f6b <slob_alloc+0x1d3>

			slob_free(cur, PAGE_SIZE);
c0104f34:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0104f3b:	00 
c0104f3c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104f3f:	89 04 24             	mov    %eax,(%esp)
c0104f42:	e8 26 00 00 00       	call   c0104f6d <slob_free>
			spin_lock_irqsave(&slob_lock, flags);
c0104f47:	e8 8f fc ff ff       	call   c0104bdb <__intr_save>
c0104f4c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
			cur = slobfree;
c0104f4f:	a1 e8 89 12 c0       	mov    0xc01289e8,%eax
c0104f54:	89 45 f0             	mov    %eax,-0x10(%ebp)
	for (cur = prev->next; ; prev = cur, cur = cur->next) {
c0104f57:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104f5a:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104f5d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104f60:	8b 40 04             	mov    0x4(%eax),%eax
c0104f63:	89 45 f0             	mov    %eax,-0x10(%ebp)
		if (align) {
c0104f66:	e9 9b fe ff ff       	jmp    c0104e06 <slob_alloc+0x6e>
		}
	}
}
c0104f6b:	c9                   	leave  
c0104f6c:	c3                   	ret    

c0104f6d <slob_free>:

static void slob_free(void *block, int size)
{
c0104f6d:	f3 0f 1e fb          	endbr32 
c0104f71:	55                   	push   %ebp
c0104f72:	89 e5                	mov    %esp,%ebp
c0104f74:	83 ec 28             	sub    $0x28,%esp
	slob_t *cur, *b = (slob_t *)block;
c0104f77:	8b 45 08             	mov    0x8(%ebp),%eax
c0104f7a:	89 45 f0             	mov    %eax,-0x10(%ebp)
	unsigned long flags;

	if (!block)
c0104f7d:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0104f81:	0f 84 01 01 00 00    	je     c0105088 <slob_free+0x11b>
		return;

	if (size)
c0104f87:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0104f8b:	74 10                	je     c0104f9d <slob_free+0x30>
		b->units = SLOB_UNITS(size);
c0104f8d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0104f90:	83 c0 07             	add    $0x7,%eax
c0104f93:	c1 e8 03             	shr    $0x3,%eax
c0104f96:	89 c2                	mov    %eax,%edx
c0104f98:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104f9b:	89 10                	mov    %edx,(%eax)

	/* Find reinsertion point */
	spin_lock_irqsave(&slob_lock, flags);
c0104f9d:	e8 39 fc ff ff       	call   c0104bdb <__intr_save>
c0104fa2:	89 45 ec             	mov    %eax,-0x14(%ebp)
	for (cur = slobfree; !(b > cur && b < cur->next); cur = cur->next)
c0104fa5:	a1 e8 89 12 c0       	mov    0xc01289e8,%eax
c0104faa:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104fad:	eb 27                	jmp    c0104fd6 <slob_free+0x69>
		if (cur >= cur->next && (b > cur || b < cur->next))
c0104faf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104fb2:	8b 40 04             	mov    0x4(%eax),%eax
c0104fb5:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0104fb8:	72 13                	jb     c0104fcd <slob_free+0x60>
c0104fba:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104fbd:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0104fc0:	77 27                	ja     c0104fe9 <slob_free+0x7c>
c0104fc2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104fc5:	8b 40 04             	mov    0x4(%eax),%eax
c0104fc8:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0104fcb:	72 1c                	jb     c0104fe9 <slob_free+0x7c>
	for (cur = slobfree; !(b > cur && b < cur->next); cur = cur->next)
c0104fcd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104fd0:	8b 40 04             	mov    0x4(%eax),%eax
c0104fd3:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0104fd6:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104fd9:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0104fdc:	76 d1                	jbe    c0104faf <slob_free+0x42>
c0104fde:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104fe1:	8b 40 04             	mov    0x4(%eax),%eax
c0104fe4:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0104fe7:	73 c6                	jae    c0104faf <slob_free+0x42>
			break;

	if (b + b->units == cur->next) {
c0104fe9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104fec:	8b 00                	mov    (%eax),%eax
c0104fee:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0104ff5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0104ff8:	01 c2                	add    %eax,%edx
c0104ffa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0104ffd:	8b 40 04             	mov    0x4(%eax),%eax
c0105000:	39 c2                	cmp    %eax,%edx
c0105002:	75 25                	jne    c0105029 <slob_free+0xbc>
		b->units += cur->next->units;
c0105004:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105007:	8b 10                	mov    (%eax),%edx
c0105009:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010500c:	8b 40 04             	mov    0x4(%eax),%eax
c010500f:	8b 00                	mov    (%eax),%eax
c0105011:	01 c2                	add    %eax,%edx
c0105013:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105016:	89 10                	mov    %edx,(%eax)
		b->next = cur->next->next;
c0105018:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010501b:	8b 40 04             	mov    0x4(%eax),%eax
c010501e:	8b 50 04             	mov    0x4(%eax),%edx
c0105021:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105024:	89 50 04             	mov    %edx,0x4(%eax)
c0105027:	eb 0c                	jmp    c0105035 <slob_free+0xc8>
	} else
		b->next = cur->next;
c0105029:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010502c:	8b 50 04             	mov    0x4(%eax),%edx
c010502f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105032:	89 50 04             	mov    %edx,0x4(%eax)

	if (cur + cur->units == b) {
c0105035:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105038:	8b 00                	mov    (%eax),%eax
c010503a:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
c0105041:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105044:	01 d0                	add    %edx,%eax
c0105046:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0105049:	75 1f                	jne    c010506a <slob_free+0xfd>
		cur->units += b->units;
c010504b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010504e:	8b 10                	mov    (%eax),%edx
c0105050:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105053:	8b 00                	mov    (%eax),%eax
c0105055:	01 c2                	add    %eax,%edx
c0105057:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010505a:	89 10                	mov    %edx,(%eax)
		cur->next = b->next;
c010505c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010505f:	8b 50 04             	mov    0x4(%eax),%edx
c0105062:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105065:	89 50 04             	mov    %edx,0x4(%eax)
c0105068:	eb 09                	jmp    c0105073 <slob_free+0x106>
	} else
		cur->next = b;
c010506a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010506d:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0105070:	89 50 04             	mov    %edx,0x4(%eax)

	slobfree = cur;
c0105073:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105076:	a3 e8 89 12 c0       	mov    %eax,0xc01289e8

	spin_unlock_irqrestore(&slob_lock, flags);
c010507b:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010507e:	89 04 24             	mov    %eax,(%esp)
c0105081:	e8 7f fb ff ff       	call   c0104c05 <__intr_restore>
c0105086:	eb 01                	jmp    c0105089 <slob_free+0x11c>
		return;
c0105088:	90                   	nop
}
c0105089:	c9                   	leave  
c010508a:	c3                   	ret    

c010508b <slob_init>:



void
slob_init(void) {
c010508b:	f3 0f 1e fb          	endbr32 
c010508f:	55                   	push   %ebp
c0105090:	89 e5                	mov    %esp,%ebp
c0105092:	83 ec 18             	sub    $0x18,%esp
  cprintf("use SLOB allocator\n");
c0105095:	c7 04 24 fe b2 10 c0 	movl   $0xc010b2fe,(%esp)
c010509c:	e8 30 b2 ff ff       	call   c01002d1 <cprintf>
}
c01050a1:	90                   	nop
c01050a2:	c9                   	leave  
c01050a3:	c3                   	ret    

c01050a4 <kmalloc_init>:

inline void 
kmalloc_init(void) {
c01050a4:	f3 0f 1e fb          	endbr32 
c01050a8:	55                   	push   %ebp
c01050a9:	89 e5                	mov    %esp,%ebp
c01050ab:	83 ec 18             	sub    $0x18,%esp
    slob_init();
c01050ae:	e8 d8 ff ff ff       	call   c010508b <slob_init>
    cprintf("kmalloc_init() succeeded!\n");
c01050b3:	c7 04 24 12 b3 10 c0 	movl   $0xc010b312,(%esp)
c01050ba:	e8 12 b2 ff ff       	call   c01002d1 <cprintf>
}
c01050bf:	90                   	nop
c01050c0:	c9                   	leave  
c01050c1:	c3                   	ret    

c01050c2 <slob_allocated>:

size_t
slob_allocated(void) {
c01050c2:	f3 0f 1e fb          	endbr32 
c01050c6:	55                   	push   %ebp
c01050c7:	89 e5                	mov    %esp,%ebp
  return 0;
c01050c9:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01050ce:	5d                   	pop    %ebp
c01050cf:	c3                   	ret    

c01050d0 <kallocated>:

size_t
kallocated(void) {
c01050d0:	f3 0f 1e fb          	endbr32 
c01050d4:	55                   	push   %ebp
c01050d5:	89 e5                	mov    %esp,%ebp
   return slob_allocated();
c01050d7:	e8 e6 ff ff ff       	call   c01050c2 <slob_allocated>
}
c01050dc:	5d                   	pop    %ebp
c01050dd:	c3                   	ret    

c01050de <find_order>:

static int find_order(int size)
{
c01050de:	f3 0f 1e fb          	endbr32 
c01050e2:	55                   	push   %ebp
c01050e3:	89 e5                	mov    %esp,%ebp
c01050e5:	83 ec 10             	sub    $0x10,%esp
	int order = 0;
c01050e8:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
	for ( ; size > 4096 ; size >>=1)
c01050ef:	eb 06                	jmp    c01050f7 <find_order+0x19>
		order++;
c01050f1:	ff 45 fc             	incl   -0x4(%ebp)
	for ( ; size > 4096 ; size >>=1)
c01050f4:	d1 7d 08             	sarl   0x8(%ebp)
c01050f7:	81 7d 08 00 10 00 00 	cmpl   $0x1000,0x8(%ebp)
c01050fe:	7f f1                	jg     c01050f1 <find_order+0x13>
	return order;
c0105100:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0105103:	c9                   	leave  
c0105104:	c3                   	ret    

c0105105 <__kmalloc>:

static void *__kmalloc(size_t size, gfp_t gfp)
{
c0105105:	f3 0f 1e fb          	endbr32 
c0105109:	55                   	push   %ebp
c010510a:	89 e5                	mov    %esp,%ebp
c010510c:	83 ec 28             	sub    $0x28,%esp
	slob_t *m;
	bigblock_t *bb;
	unsigned long flags;

	if (size < PAGE_SIZE - SLOB_UNIT) {
c010510f:	81 7d 08 f7 0f 00 00 	cmpl   $0xff7,0x8(%ebp)
c0105116:	77 3b                	ja     c0105153 <__kmalloc+0x4e>
		m = slob_alloc(size + SLOB_UNIT, gfp, 0);
c0105118:	8b 45 08             	mov    0x8(%ebp),%eax
c010511b:	8d 50 08             	lea    0x8(%eax),%edx
c010511e:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0105125:	00 
c0105126:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105129:	89 44 24 04          	mov    %eax,0x4(%esp)
c010512d:	89 14 24             	mov    %edx,(%esp)
c0105130:	e8 63 fc ff ff       	call   c0104d98 <slob_alloc>
c0105135:	89 45 ec             	mov    %eax,-0x14(%ebp)
		return m ? (void *)(m + 1) : 0;
c0105138:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010513c:	74 0b                	je     c0105149 <__kmalloc+0x44>
c010513e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105141:	83 c0 08             	add    $0x8,%eax
c0105144:	e9 b0 00 00 00       	jmp    c01051f9 <__kmalloc+0xf4>
c0105149:	b8 00 00 00 00       	mov    $0x0,%eax
c010514e:	e9 a6 00 00 00       	jmp    c01051f9 <__kmalloc+0xf4>
	}

	bb = slob_alloc(sizeof(bigblock_t), gfp, 0);
c0105153:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010515a:	00 
c010515b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010515e:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105162:	c7 04 24 0c 00 00 00 	movl   $0xc,(%esp)
c0105169:	e8 2a fc ff ff       	call   c0104d98 <slob_alloc>
c010516e:	89 45 f4             	mov    %eax,-0xc(%ebp)
	if (!bb)
c0105171:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105175:	75 07                	jne    c010517e <__kmalloc+0x79>
		return 0;
c0105177:	b8 00 00 00 00       	mov    $0x0,%eax
c010517c:	eb 7b                	jmp    c01051f9 <__kmalloc+0xf4>

	bb->order = find_order(size);
c010517e:	8b 45 08             	mov    0x8(%ebp),%eax
c0105181:	89 04 24             	mov    %eax,(%esp)
c0105184:	e8 55 ff ff ff       	call   c01050de <find_order>
c0105189:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010518c:	89 02                	mov    %eax,(%edx)
	bb->pages = (void *)__slob_get_free_pages(gfp, bb->order);
c010518e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105191:	8b 00                	mov    (%eax),%eax
c0105193:	89 44 24 04          	mov    %eax,0x4(%esp)
c0105197:	8b 45 0c             	mov    0xc(%ebp),%eax
c010519a:	89 04 24             	mov    %eax,(%esp)
c010519d:	e8 84 fb ff ff       	call   c0104d26 <__slob_get_free_pages>
c01051a2:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01051a5:	89 42 04             	mov    %eax,0x4(%edx)

	if (bb->pages) {
c01051a8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01051ab:	8b 40 04             	mov    0x4(%eax),%eax
c01051ae:	85 c0                	test   %eax,%eax
c01051b0:	74 2f                	je     c01051e1 <__kmalloc+0xdc>
		spin_lock_irqsave(&block_lock, flags);
c01051b2:	e8 24 fa ff ff       	call   c0104bdb <__intr_save>
c01051b7:	89 45 f0             	mov    %eax,-0x10(%ebp)
		bb->next = bigblocks;
c01051ba:	8b 15 74 bf 12 c0    	mov    0xc012bf74,%edx
c01051c0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01051c3:	89 50 08             	mov    %edx,0x8(%eax)
		bigblocks = bb;
c01051c6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01051c9:	a3 74 bf 12 c0       	mov    %eax,0xc012bf74
		spin_unlock_irqrestore(&block_lock, flags);
c01051ce:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01051d1:	89 04 24             	mov    %eax,(%esp)
c01051d4:	e8 2c fa ff ff       	call   c0104c05 <__intr_restore>
		return bb->pages;
c01051d9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01051dc:	8b 40 04             	mov    0x4(%eax),%eax
c01051df:	eb 18                	jmp    c01051f9 <__kmalloc+0xf4>
	}

	slob_free(bb, sizeof(bigblock_t));
c01051e1:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
c01051e8:	00 
c01051e9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01051ec:	89 04 24             	mov    %eax,(%esp)
c01051ef:	e8 79 fd ff ff       	call   c0104f6d <slob_free>
	return 0;
c01051f4:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01051f9:	c9                   	leave  
c01051fa:	c3                   	ret    

c01051fb <kmalloc>:

void *
kmalloc(size_t size)
{
c01051fb:	f3 0f 1e fb          	endbr32 
c01051ff:	55                   	push   %ebp
c0105200:	89 e5                	mov    %esp,%ebp
c0105202:	83 ec 18             	sub    $0x18,%esp
  return __kmalloc(size, 0);
c0105205:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010520c:	00 
c010520d:	8b 45 08             	mov    0x8(%ebp),%eax
c0105210:	89 04 24             	mov    %eax,(%esp)
c0105213:	e8 ed fe ff ff       	call   c0105105 <__kmalloc>
}
c0105218:	c9                   	leave  
c0105219:	c3                   	ret    

c010521a <kfree>:


void kfree(void *block)
{
c010521a:	f3 0f 1e fb          	endbr32 
c010521e:	55                   	push   %ebp
c010521f:	89 e5                	mov    %esp,%ebp
c0105221:	83 ec 28             	sub    $0x28,%esp
	bigblock_t *bb, **last = &bigblocks;
c0105224:	c7 45 f0 74 bf 12 c0 	movl   $0xc012bf74,-0x10(%ebp)
	unsigned long flags;

	if (!block)
c010522b:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c010522f:	0f 84 a3 00 00 00    	je     c01052d8 <kfree+0xbe>
		return;

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
c0105235:	8b 45 08             	mov    0x8(%ebp),%eax
c0105238:	25 ff 0f 00 00       	and    $0xfff,%eax
c010523d:	85 c0                	test   %eax,%eax
c010523f:	75 7f                	jne    c01052c0 <kfree+0xa6>
		/* might be on the big block list */
		spin_lock_irqsave(&block_lock, flags);
c0105241:	e8 95 f9 ff ff       	call   c0104bdb <__intr_save>
c0105246:	89 45 ec             	mov    %eax,-0x14(%ebp)
		for (bb = bigblocks; bb; last = &bb->next, bb = bb->next) {
c0105249:	a1 74 bf 12 c0       	mov    0xc012bf74,%eax
c010524e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105251:	eb 5c                	jmp    c01052af <kfree+0x95>
			if (bb->pages == block) {
c0105253:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105256:	8b 40 04             	mov    0x4(%eax),%eax
c0105259:	39 45 08             	cmp    %eax,0x8(%ebp)
c010525c:	75 3f                	jne    c010529d <kfree+0x83>
				*last = bb->next;
c010525e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105261:	8b 50 08             	mov    0x8(%eax),%edx
c0105264:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105267:	89 10                	mov    %edx,(%eax)
				spin_unlock_irqrestore(&block_lock, flags);
c0105269:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010526c:	89 04 24             	mov    %eax,(%esp)
c010526f:	e8 91 f9 ff ff       	call   c0104c05 <__intr_restore>
				__slob_free_pages((unsigned long)block, bb->order);
c0105274:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105277:	8b 10                	mov    (%eax),%edx
c0105279:	8b 45 08             	mov    0x8(%ebp),%eax
c010527c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0105280:	89 04 24             	mov    %eax,(%esp)
c0105283:	e8 db fa ff ff       	call   c0104d63 <__slob_free_pages>
				slob_free(bb, sizeof(bigblock_t));
c0105288:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
c010528f:	00 
c0105290:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105293:	89 04 24             	mov    %eax,(%esp)
c0105296:	e8 d2 fc ff ff       	call   c0104f6d <slob_free>
				return;
c010529b:	eb 3c                	jmp    c01052d9 <kfree+0xbf>
		for (bb = bigblocks; bb; last = &bb->next, bb = bb->next) {
c010529d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01052a0:	83 c0 08             	add    $0x8,%eax
c01052a3:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01052a6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01052a9:	8b 40 08             	mov    0x8(%eax),%eax
c01052ac:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01052af:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01052b3:	75 9e                	jne    c0105253 <kfree+0x39>
			}
		}
		spin_unlock_irqrestore(&block_lock, flags);
c01052b5:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01052b8:	89 04 24             	mov    %eax,(%esp)
c01052bb:	e8 45 f9 ff ff       	call   c0104c05 <__intr_restore>
	}

	slob_free((slob_t *)block - 1, 0);
c01052c0:	8b 45 08             	mov    0x8(%ebp),%eax
c01052c3:	83 e8 08             	sub    $0x8,%eax
c01052c6:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01052cd:	00 
c01052ce:	89 04 24             	mov    %eax,(%esp)
c01052d1:	e8 97 fc ff ff       	call   c0104f6d <slob_free>
	return;
c01052d6:	eb 01                	jmp    c01052d9 <kfree+0xbf>
		return;
c01052d8:	90                   	nop
}
c01052d9:	c9                   	leave  
c01052da:	c3                   	ret    

c01052db <ksize>:


unsigned int ksize(const void *block)
{
c01052db:	f3 0f 1e fb          	endbr32 
c01052df:	55                   	push   %ebp
c01052e0:	89 e5                	mov    %esp,%ebp
c01052e2:	83 ec 28             	sub    $0x28,%esp
	bigblock_t *bb;
	unsigned long flags;

	if (!block)
c01052e5:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01052e9:	75 07                	jne    c01052f2 <ksize+0x17>
		return 0;
c01052eb:	b8 00 00 00 00       	mov    $0x0,%eax
c01052f0:	eb 6b                	jmp    c010535d <ksize+0x82>

	if (!((unsigned long)block & (PAGE_SIZE-1))) {
c01052f2:	8b 45 08             	mov    0x8(%ebp),%eax
c01052f5:	25 ff 0f 00 00       	and    $0xfff,%eax
c01052fa:	85 c0                	test   %eax,%eax
c01052fc:	75 54                	jne    c0105352 <ksize+0x77>
		spin_lock_irqsave(&block_lock, flags);
c01052fe:	e8 d8 f8 ff ff       	call   c0104bdb <__intr_save>
c0105303:	89 45 f0             	mov    %eax,-0x10(%ebp)
		for (bb = bigblocks; bb; bb = bb->next)
c0105306:	a1 74 bf 12 c0       	mov    0xc012bf74,%eax
c010530b:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010530e:	eb 31                	jmp    c0105341 <ksize+0x66>
			if (bb->pages == block) {
c0105310:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105313:	8b 40 04             	mov    0x4(%eax),%eax
c0105316:	39 45 08             	cmp    %eax,0x8(%ebp)
c0105319:	75 1d                	jne    c0105338 <ksize+0x5d>
				spin_unlock_irqrestore(&slob_lock, flags);
c010531b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010531e:	89 04 24             	mov    %eax,(%esp)
c0105321:	e8 df f8 ff ff       	call   c0104c05 <__intr_restore>
				return PAGE_SIZE << bb->order;
c0105326:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105329:	8b 00                	mov    (%eax),%eax
c010532b:	ba 00 10 00 00       	mov    $0x1000,%edx
c0105330:	88 c1                	mov    %al,%cl
c0105332:	d3 e2                	shl    %cl,%edx
c0105334:	89 d0                	mov    %edx,%eax
c0105336:	eb 25                	jmp    c010535d <ksize+0x82>
		for (bb = bigblocks; bb; bb = bb->next)
c0105338:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010533b:	8b 40 08             	mov    0x8(%eax),%eax
c010533e:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105341:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105345:	75 c9                	jne    c0105310 <ksize+0x35>
			}
		spin_unlock_irqrestore(&block_lock, flags);
c0105347:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010534a:	89 04 24             	mov    %eax,(%esp)
c010534d:	e8 b3 f8 ff ff       	call   c0104c05 <__intr_restore>
	}

	return ((slob_t *)block - 1)->units * SLOB_UNIT;
c0105352:	8b 45 08             	mov    0x8(%ebp),%eax
c0105355:	83 e8 08             	sub    $0x8,%eax
c0105358:	8b 00                	mov    (%eax),%eax
c010535a:	c1 e0 03             	shl    $0x3,%eax
}
c010535d:	c9                   	leave  
c010535e:	c3                   	ret    

c010535f <_fifo_init_mm>:
 * (2) _fifo_init_mm: init pra_list_head and let  mm->sm_priv point to the addr of pra_list_head.
 *              Now, From the memory control struct mm_struct, we can access FIFO PRA
 */
static int
_fifo_init_mm(struct mm_struct *mm)
{     
c010535f:	f3 0f 1e fb          	endbr32 
c0105363:	55                   	push   %ebp
c0105364:	89 e5                	mov    %esp,%ebp
c0105366:	83 ec 10             	sub    $0x10,%esp
c0105369:	c7 45 fc 24 e1 12 c0 	movl   $0xc012e124,-0x4(%ebp)
    elm->prev = elm->next = elm;
c0105370:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105373:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0105376:	89 50 04             	mov    %edx,0x4(%eax)
c0105379:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010537c:	8b 50 04             	mov    0x4(%eax),%edx
c010537f:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105382:	89 10                	mov    %edx,(%eax)
}
c0105384:	90                   	nop
     list_init(&pra_list_head);
     mm->sm_priv = &pra_list_head;
c0105385:	8b 45 08             	mov    0x8(%ebp),%eax
c0105388:	c7 40 14 24 e1 12 c0 	movl   $0xc012e124,0x14(%eax)
     //cprintf(" mm->sm_priv %x in fifo_init_mm\n",mm->sm_priv);
     return 0;
c010538f:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0105394:	c9                   	leave  
c0105395:	c3                   	ret    

c0105396 <_fifo_map_swappable>:
/*
 * (3)_fifo_map_swappable: According FIFO PRA, we should link the most recent arrival page at the back of pra_list_head qeueue
 */
static int
_fifo_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in)
{
c0105396:	f3 0f 1e fb          	endbr32 
c010539a:	55                   	push   %ebp
c010539b:	89 e5                	mov    %esp,%ebp
c010539d:	83 ec 48             	sub    $0x48,%esp
    list_entry_t *head=(list_entry_t*) mm->sm_priv;
c01053a0:	8b 45 08             	mov    0x8(%ebp),%eax
c01053a3:	8b 40 14             	mov    0x14(%eax),%eax
c01053a6:	89 45 f4             	mov    %eax,-0xc(%ebp)
    list_entry_t *entry=&(page->pra_page_link);
c01053a9:	8b 45 10             	mov    0x10(%ebp),%eax
c01053ac:	83 c0 14             	add    $0x14,%eax
c01053af:	89 45 f0             	mov    %eax,-0x10(%ebp)
 
    assert(entry != NULL && head != NULL);
c01053b2:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01053b6:	74 06                	je     c01053be <_fifo_map_swappable+0x28>
c01053b8:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01053bc:	75 24                	jne    c01053e2 <_fifo_map_swappable+0x4c>
c01053be:	c7 44 24 0c 30 b3 10 	movl   $0xc010b330,0xc(%esp)
c01053c5:	c0 
c01053c6:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c01053cd:	c0 
c01053ce:	c7 44 24 04 32 00 00 	movl   $0x32,0x4(%esp)
c01053d5:	00 
c01053d6:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c01053dd:	e8 5b b0 ff ff       	call   c010043d <__panic>
c01053e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01053e5:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01053e8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01053eb:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01053ee:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01053f1:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01053f4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01053f7:	89 45 e0             	mov    %eax,-0x20(%ebp)
    __list_add(elm, listelm, listelm->next);
c01053fa:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01053fd:	8b 40 04             	mov    0x4(%eax),%eax
c0105400:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105403:	89 55 dc             	mov    %edx,-0x24(%ebp)
c0105406:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0105409:	89 55 d8             	mov    %edx,-0x28(%ebp)
c010540c:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    prev->next = next->prev = elm;
c010540f:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0105412:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0105415:	89 10                	mov    %edx,(%eax)
c0105417:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010541a:	8b 10                	mov    (%eax),%edx
c010541c:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010541f:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0105422:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105425:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0105428:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c010542b:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010542e:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0105431:	89 10                	mov    %edx,(%eax)
}
c0105433:	90                   	nop
}
c0105434:	90                   	nop
}
c0105435:	90                   	nop
    //record the page access situlation
    /*LAB3 EXERCISE 2: YOUR CODE*/ 
    //(1)link the most recent arrival page at the back of the pra_list_head qeueue.
    list_add(head, entry);
    return 0;
c0105436:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010543b:	c9                   	leave  
c010543c:	c3                   	ret    

c010543d <_fifo_swap_out_victim>:
 *  (4)_fifo_swap_out_victim: According FIFO PRA, we should unlink the  earliest arrival page in front of pra_list_head qeueue,
 *                            then assign the value of *ptr_page to the addr of this page.
 */
static int
_fifo_swap_out_victim(struct mm_struct *mm, struct Page ** ptr_page, int in_tick)
{
c010543d:	f3 0f 1e fb          	endbr32 
c0105441:	55                   	push   %ebp
c0105442:	89 e5                	mov    %esp,%ebp
c0105444:	83 ec 38             	sub    $0x38,%esp
     list_entry_t *head=(list_entry_t*) mm->sm_priv;
c0105447:	8b 45 08             	mov    0x8(%ebp),%eax
c010544a:	8b 40 14             	mov    0x14(%eax),%eax
c010544d:	89 45 f4             	mov    %eax,-0xc(%ebp)
         assert(head != NULL);
c0105450:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105454:	75 24                	jne    c010547a <_fifo_swap_out_victim+0x3d>
c0105456:	c7 44 24 0c 77 b3 10 	movl   $0xc010b377,0xc(%esp)
c010545d:	c0 
c010545e:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c0105465:	c0 
c0105466:	c7 44 24 04 41 00 00 	movl   $0x41,0x4(%esp)
c010546d:	00 
c010546e:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c0105475:	e8 c3 af ff ff       	call   c010043d <__panic>
     assert(in_tick==0);
c010547a:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010547e:	74 24                	je     c01054a4 <_fifo_swap_out_victim+0x67>
c0105480:	c7 44 24 0c 84 b3 10 	movl   $0xc010b384,0xc(%esp)
c0105487:	c0 
c0105488:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c010548f:	c0 
c0105490:	c7 44 24 04 42 00 00 	movl   $0x42,0x4(%esp)
c0105497:	00 
c0105498:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c010549f:	e8 99 af ff ff       	call   c010043d <__panic>
     /* Select the victim */
     /*LAB3 EXERCISE 2: YOUR CODE*/ 
     //(1)  unlink the  earliest arrival page in front of pra_list_head qeueue
     //(2)  assign the value of *ptr_page to the addr of this page
     /* Select the tail */
     list_entry_t *le = head->prev;
c01054a4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01054a7:	8b 00                	mov    (%eax),%eax
c01054a9:	89 45 f0             	mov    %eax,-0x10(%ebp)
     assert(head!=le);
c01054ac:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01054af:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c01054b2:	75 24                	jne    c01054d8 <_fifo_swap_out_victim+0x9b>
c01054b4:	c7 44 24 0c 8f b3 10 	movl   $0xc010b38f,0xc(%esp)
c01054bb:	c0 
c01054bc:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c01054c3:	c0 
c01054c4:	c7 44 24 04 49 00 00 	movl   $0x49,0x4(%esp)
c01054cb:	00 
c01054cc:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c01054d3:	e8 65 af ff ff       	call   c010043d <__panic>
     struct Page *p = le2page(le, pra_page_link);
c01054d8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01054db:	83 e8 14             	sub    $0x14,%eax
c01054de:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01054e1:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01054e4:	89 45 e8             	mov    %eax,-0x18(%ebp)
    __list_del(listelm->prev, listelm->next);
c01054e7:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01054ea:	8b 40 04             	mov    0x4(%eax),%eax
c01054ed:	8b 55 e8             	mov    -0x18(%ebp),%edx
c01054f0:	8b 12                	mov    (%edx),%edx
c01054f2:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c01054f5:	89 45 e0             	mov    %eax,-0x20(%ebp)
    prev->next = next;
c01054f8:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01054fb:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01054fe:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0105501:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105504:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0105507:	89 10                	mov    %edx,(%eax)
}
c0105509:	90                   	nop
}
c010550a:	90                   	nop
     list_del(le);
     assert(p !=NULL);
c010550b:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010550f:	75 24                	jne    c0105535 <_fifo_swap_out_victim+0xf8>
c0105511:	c7 44 24 0c 98 b3 10 	movl   $0xc010b398,0xc(%esp)
c0105518:	c0 
c0105519:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c0105520:	c0 
c0105521:	c7 44 24 04 4c 00 00 	movl   $0x4c,0x4(%esp)
c0105528:	00 
c0105529:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c0105530:	e8 08 af ff ff       	call   c010043d <__panic>
     *ptr_page = p;
c0105535:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105538:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010553b:	89 10                	mov    %edx,(%eax)
     return 0;
c010553d:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0105542:	c9                   	leave  
c0105543:	c3                   	ret    

c0105544 <_fifo_check_swap>:

static int
_fifo_check_swap(void) {
c0105544:	f3 0f 1e fb          	endbr32 
c0105548:	55                   	push   %ebp
c0105549:	89 e5                	mov    %esp,%ebp
c010554b:	83 ec 18             	sub    $0x18,%esp
    cprintf("write Virt Page c in fifo_check_swap\n");
c010554e:	c7 04 24 a4 b3 10 c0 	movl   $0xc010b3a4,(%esp)
c0105555:	e8 77 ad ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c010555a:	b8 00 30 00 00       	mov    $0x3000,%eax
c010555f:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==4);
c0105562:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c0105567:	83 f8 04             	cmp    $0x4,%eax
c010556a:	74 24                	je     c0105590 <_fifo_check_swap+0x4c>
c010556c:	c7 44 24 0c ca b3 10 	movl   $0xc010b3ca,0xc(%esp)
c0105573:	c0 
c0105574:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c010557b:	c0 
c010557c:	c7 44 24 04 55 00 00 	movl   $0x55,0x4(%esp)
c0105583:	00 
c0105584:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c010558b:	e8 ad ae ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c0105590:	c7 04 24 dc b3 10 c0 	movl   $0xc010b3dc,(%esp)
c0105597:	e8 35 ad ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c010559c:	b8 00 10 00 00       	mov    $0x1000,%eax
c01055a1:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==4);
c01055a4:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01055a9:	83 f8 04             	cmp    $0x4,%eax
c01055ac:	74 24                	je     c01055d2 <_fifo_check_swap+0x8e>
c01055ae:	c7 44 24 0c ca b3 10 	movl   $0xc010b3ca,0xc(%esp)
c01055b5:	c0 
c01055b6:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c01055bd:	c0 
c01055be:	c7 44 24 04 58 00 00 	movl   $0x58,0x4(%esp)
c01055c5:	00 
c01055c6:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c01055cd:	e8 6b ae ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c01055d2:	c7 04 24 04 b4 10 c0 	movl   $0xc010b404,(%esp)
c01055d9:	e8 f3 ac ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c01055de:	b8 00 40 00 00       	mov    $0x4000,%eax
c01055e3:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==4);
c01055e6:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01055eb:	83 f8 04             	cmp    $0x4,%eax
c01055ee:	74 24                	je     c0105614 <_fifo_check_swap+0xd0>
c01055f0:	c7 44 24 0c ca b3 10 	movl   $0xc010b3ca,0xc(%esp)
c01055f7:	c0 
c01055f8:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c01055ff:	c0 
c0105600:	c7 44 24 04 5b 00 00 	movl   $0x5b,0x4(%esp)
c0105607:	00 
c0105608:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c010560f:	e8 29 ae ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c0105614:	c7 04 24 2c b4 10 c0 	movl   $0xc010b42c,(%esp)
c010561b:	e8 b1 ac ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c0105620:	b8 00 20 00 00       	mov    $0x2000,%eax
c0105625:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==4);
c0105628:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c010562d:	83 f8 04             	cmp    $0x4,%eax
c0105630:	74 24                	je     c0105656 <_fifo_check_swap+0x112>
c0105632:	c7 44 24 0c ca b3 10 	movl   $0xc010b3ca,0xc(%esp)
c0105639:	c0 
c010563a:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c0105641:	c0 
c0105642:	c7 44 24 04 5e 00 00 	movl   $0x5e,0x4(%esp)
c0105649:	00 
c010564a:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c0105651:	e8 e7 ad ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page e in fifo_check_swap\n");
c0105656:	c7 04 24 54 b4 10 c0 	movl   $0xc010b454,(%esp)
c010565d:	e8 6f ac ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x5000 = 0x0e;
c0105662:	b8 00 50 00 00       	mov    $0x5000,%eax
c0105667:	c6 00 0e             	movb   $0xe,(%eax)
    assert(pgfault_num==5);
c010566a:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c010566f:	83 f8 05             	cmp    $0x5,%eax
c0105672:	74 24                	je     c0105698 <_fifo_check_swap+0x154>
c0105674:	c7 44 24 0c 7a b4 10 	movl   $0xc010b47a,0xc(%esp)
c010567b:	c0 
c010567c:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c0105683:	c0 
c0105684:	c7 44 24 04 61 00 00 	movl   $0x61,0x4(%esp)
c010568b:	00 
c010568c:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c0105693:	e8 a5 ad ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c0105698:	c7 04 24 2c b4 10 c0 	movl   $0xc010b42c,(%esp)
c010569f:	e8 2d ac ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c01056a4:	b8 00 20 00 00       	mov    $0x2000,%eax
c01056a9:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==5);
c01056ac:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01056b1:	83 f8 05             	cmp    $0x5,%eax
c01056b4:	74 24                	je     c01056da <_fifo_check_swap+0x196>
c01056b6:	c7 44 24 0c 7a b4 10 	movl   $0xc010b47a,0xc(%esp)
c01056bd:	c0 
c01056be:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c01056c5:	c0 
c01056c6:	c7 44 24 04 64 00 00 	movl   $0x64,0x4(%esp)
c01056cd:	00 
c01056ce:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c01056d5:	e8 63 ad ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c01056da:	c7 04 24 dc b3 10 c0 	movl   $0xc010b3dc,(%esp)
c01056e1:	e8 eb ab ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x1000 = 0x0a;
c01056e6:	b8 00 10 00 00       	mov    $0x1000,%eax
c01056eb:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==6);
c01056ee:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01056f3:	83 f8 06             	cmp    $0x6,%eax
c01056f6:	74 24                	je     c010571c <_fifo_check_swap+0x1d8>
c01056f8:	c7 44 24 0c 89 b4 10 	movl   $0xc010b489,0xc(%esp)
c01056ff:	c0 
c0105700:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c0105707:	c0 
c0105708:	c7 44 24 04 67 00 00 	movl   $0x67,0x4(%esp)
c010570f:	00 
c0105710:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c0105717:	e8 21 ad ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page b in fifo_check_swap\n");
c010571c:	c7 04 24 2c b4 10 c0 	movl   $0xc010b42c,(%esp)
c0105723:	e8 a9 ab ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x2000 = 0x0b;
c0105728:	b8 00 20 00 00       	mov    $0x2000,%eax
c010572d:	c6 00 0b             	movb   $0xb,(%eax)
    assert(pgfault_num==7);
c0105730:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c0105735:	83 f8 07             	cmp    $0x7,%eax
c0105738:	74 24                	je     c010575e <_fifo_check_swap+0x21a>
c010573a:	c7 44 24 0c 98 b4 10 	movl   $0xc010b498,0xc(%esp)
c0105741:	c0 
c0105742:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c0105749:	c0 
c010574a:	c7 44 24 04 6a 00 00 	movl   $0x6a,0x4(%esp)
c0105751:	00 
c0105752:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c0105759:	e8 df ac ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page c in fifo_check_swap\n");
c010575e:	c7 04 24 a4 b3 10 c0 	movl   $0xc010b3a4,(%esp)
c0105765:	e8 67 ab ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x3000 = 0x0c;
c010576a:	b8 00 30 00 00       	mov    $0x3000,%eax
c010576f:	c6 00 0c             	movb   $0xc,(%eax)
    assert(pgfault_num==8);
c0105772:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c0105777:	83 f8 08             	cmp    $0x8,%eax
c010577a:	74 24                	je     c01057a0 <_fifo_check_swap+0x25c>
c010577c:	c7 44 24 0c a7 b4 10 	movl   $0xc010b4a7,0xc(%esp)
c0105783:	c0 
c0105784:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c010578b:	c0 
c010578c:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c0105793:	00 
c0105794:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c010579b:	e8 9d ac ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page d in fifo_check_swap\n");
c01057a0:	c7 04 24 04 b4 10 c0 	movl   $0xc010b404,(%esp)
c01057a7:	e8 25 ab ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x4000 = 0x0d;
c01057ac:	b8 00 40 00 00       	mov    $0x4000,%eax
c01057b1:	c6 00 0d             	movb   $0xd,(%eax)
    assert(pgfault_num==9);
c01057b4:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01057b9:	83 f8 09             	cmp    $0x9,%eax
c01057bc:	74 24                	je     c01057e2 <_fifo_check_swap+0x29e>
c01057be:	c7 44 24 0c b6 b4 10 	movl   $0xc010b4b6,0xc(%esp)
c01057c5:	c0 
c01057c6:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c01057cd:	c0 
c01057ce:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
c01057d5:	00 
c01057d6:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c01057dd:	e8 5b ac ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page e in fifo_check_swap\n");
c01057e2:	c7 04 24 54 b4 10 c0 	movl   $0xc010b454,(%esp)
c01057e9:	e8 e3 aa ff ff       	call   c01002d1 <cprintf>
    *(unsigned char *)0x5000 = 0x0e;
c01057ee:	b8 00 50 00 00       	mov    $0x5000,%eax
c01057f3:	c6 00 0e             	movb   $0xe,(%eax)
    assert(pgfault_num==10);
c01057f6:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c01057fb:	83 f8 0a             	cmp    $0xa,%eax
c01057fe:	74 24                	je     c0105824 <_fifo_check_swap+0x2e0>
c0105800:	c7 44 24 0c c5 b4 10 	movl   $0xc010b4c5,0xc(%esp)
c0105807:	c0 
c0105808:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c010580f:	c0 
c0105810:	c7 44 24 04 73 00 00 	movl   $0x73,0x4(%esp)
c0105817:	00 
c0105818:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c010581f:	e8 19 ac ff ff       	call   c010043d <__panic>
    cprintf("write Virt Page a in fifo_check_swap\n");
c0105824:	c7 04 24 dc b3 10 c0 	movl   $0xc010b3dc,(%esp)
c010582b:	e8 a1 aa ff ff       	call   c01002d1 <cprintf>
    assert(*(unsigned char *)0x1000 == 0x0a);
c0105830:	b8 00 10 00 00       	mov    $0x1000,%eax
c0105835:	0f b6 00             	movzbl (%eax),%eax
c0105838:	3c 0a                	cmp    $0xa,%al
c010583a:	74 24                	je     c0105860 <_fifo_check_swap+0x31c>
c010583c:	c7 44 24 0c d8 b4 10 	movl   $0xc010b4d8,0xc(%esp)
c0105843:	c0 
c0105844:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c010584b:	c0 
c010584c:	c7 44 24 04 75 00 00 	movl   $0x75,0x4(%esp)
c0105853:	00 
c0105854:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c010585b:	e8 dd ab ff ff       	call   c010043d <__panic>
    *(unsigned char *)0x1000 = 0x0a;
c0105860:	b8 00 10 00 00       	mov    $0x1000,%eax
c0105865:	c6 00 0a             	movb   $0xa,(%eax)
    assert(pgfault_num==11);
c0105868:	a1 64 bf 12 c0       	mov    0xc012bf64,%eax
c010586d:	83 f8 0b             	cmp    $0xb,%eax
c0105870:	74 24                	je     c0105896 <_fifo_check_swap+0x352>
c0105872:	c7 44 24 0c f9 b4 10 	movl   $0xc010b4f9,0xc(%esp)
c0105879:	c0 
c010587a:	c7 44 24 08 4e b3 10 	movl   $0xc010b34e,0x8(%esp)
c0105881:	c0 
c0105882:	c7 44 24 04 77 00 00 	movl   $0x77,0x4(%esp)
c0105889:	00 
c010588a:	c7 04 24 63 b3 10 c0 	movl   $0xc010b363,(%esp)
c0105891:	e8 a7 ab ff ff       	call   c010043d <__panic>
    return 0;
c0105896:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010589b:	c9                   	leave  
c010589c:	c3                   	ret    

c010589d <_fifo_init>:


static int
_fifo_init(void)
{
c010589d:	f3 0f 1e fb          	endbr32 
c01058a1:	55                   	push   %ebp
c01058a2:	89 e5                	mov    %esp,%ebp
    return 0;
c01058a4:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01058a9:	5d                   	pop    %ebp
c01058aa:	c3                   	ret    

c01058ab <_fifo_set_unswappable>:

static int
_fifo_set_unswappable(struct mm_struct *mm, uintptr_t addr)
{
c01058ab:	f3 0f 1e fb          	endbr32 
c01058af:	55                   	push   %ebp
c01058b0:	89 e5                	mov    %esp,%ebp
    return 0;
c01058b2:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01058b7:	5d                   	pop    %ebp
c01058b8:	c3                   	ret    

c01058b9 <_fifo_tick_event>:

static int
_fifo_tick_event(struct mm_struct *mm)
{ return 0; }
c01058b9:	f3 0f 1e fb          	endbr32 
c01058bd:	55                   	push   %ebp
c01058be:	89 e5                	mov    %esp,%ebp
c01058c0:	b8 00 00 00 00       	mov    $0x0,%eax
c01058c5:	5d                   	pop    %ebp
c01058c6:	c3                   	ret    

c01058c7 <page2ppn>:
page2ppn(struct Page *page) {
c01058c7:	55                   	push   %ebp
c01058c8:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01058ca:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c01058cf:	8b 55 08             	mov    0x8(%ebp),%edx
c01058d2:	29 c2                	sub    %eax,%edx
c01058d4:	89 d0                	mov    %edx,%eax
c01058d6:	c1 f8 05             	sar    $0x5,%eax
}
c01058d9:	5d                   	pop    %ebp
c01058da:	c3                   	ret    

c01058db <page2pa>:
page2pa(struct Page *page) {
c01058db:	55                   	push   %ebp
c01058dc:	89 e5                	mov    %esp,%ebp
c01058de:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01058e1:	8b 45 08             	mov    0x8(%ebp),%eax
c01058e4:	89 04 24             	mov    %eax,(%esp)
c01058e7:	e8 db ff ff ff       	call   c01058c7 <page2ppn>
c01058ec:	c1 e0 0c             	shl    $0xc,%eax
}
c01058ef:	c9                   	leave  
c01058f0:	c3                   	ret    

c01058f1 <page_ref>:

static inline int
page_ref(struct Page *page) {
c01058f1:	55                   	push   %ebp
c01058f2:	89 e5                	mov    %esp,%ebp
    return page->ref;
c01058f4:	8b 45 08             	mov    0x8(%ebp),%eax
c01058f7:	8b 00                	mov    (%eax),%eax
}
c01058f9:	5d                   	pop    %ebp
c01058fa:	c3                   	ret    

c01058fb <set_page_ref>:

static inline void
set_page_ref(struct Page *page, int val) {
c01058fb:	55                   	push   %ebp
c01058fc:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c01058fe:	8b 45 08             	mov    0x8(%ebp),%eax
c0105901:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105904:	89 10                	mov    %edx,(%eax)
}
c0105906:	90                   	nop
c0105907:	5d                   	pop    %ebp
c0105908:	c3                   	ret    

c0105909 <default_init>:

#define free_list (free_area.free_list)
#define nr_free (free_area.nr_free)

static void
default_init(void) {
c0105909:	f3 0f 1e fb          	endbr32 
c010590d:	55                   	push   %ebp
c010590e:	89 e5                	mov    %esp,%ebp
c0105910:	83 ec 10             	sub    $0x10,%esp
c0105913:	c7 45 fc 2c e1 12 c0 	movl   $0xc012e12c,-0x4(%ebp)
    elm->prev = elm->next = elm;
c010591a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010591d:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0105920:	89 50 04             	mov    %edx,0x4(%eax)
c0105923:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0105926:	8b 50 04             	mov    0x4(%eax),%edx
c0105929:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010592c:	89 10                	mov    %edx,(%eax)
}
c010592e:	90                   	nop
    list_init(&free_list);
    nr_free = 0;
c010592f:	c7 05 34 e1 12 c0 00 	movl   $0x0,0xc012e134
c0105936:	00 00 00 
}
c0105939:	90                   	nop
c010593a:	c9                   	leave  
c010593b:	c3                   	ret    

c010593c <default_init_memmap>:

static void
default_init_memmap(struct Page *base, size_t n) {
c010593c:	f3 0f 1e fb          	endbr32 
c0105940:	55                   	push   %ebp
c0105941:	89 e5                	mov    %esp,%ebp
c0105943:	83 ec 48             	sub    $0x48,%esp
    assert(n > 0);
c0105946:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c010594a:	75 24                	jne    c0105970 <default_init_memmap+0x34>
c010594c:	c7 44 24 0c 1c b5 10 	movl   $0xc010b51c,0xc(%esp)
c0105953:	c0 
c0105954:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c010595b:	c0 
c010595c:	c7 44 24 04 6d 00 00 	movl   $0x6d,0x4(%esp)
c0105963:	00 
c0105964:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c010596b:	e8 cd aa ff ff       	call   c010043d <__panic>
    struct Page *p = base;
c0105970:	8b 45 08             	mov    0x8(%ebp),%eax
c0105973:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; p != base + n; p ++) {
c0105976:	eb 7d                	jmp    c01059f5 <default_init_memmap+0xb9>
        assert(PageReserved(p));
c0105978:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010597b:	83 c0 04             	add    $0x4,%eax
c010597e:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
c0105985:	89 45 ec             	mov    %eax,-0x14(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0105988:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010598b:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010598e:	0f a3 10             	bt     %edx,(%eax)
c0105991:	19 c0                	sbb    %eax,%eax
c0105993:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return oldbit != 0;
c0105996:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010599a:	0f 95 c0             	setne  %al
c010599d:	0f b6 c0             	movzbl %al,%eax
c01059a0:	85 c0                	test   %eax,%eax
c01059a2:	75 24                	jne    c01059c8 <default_init_memmap+0x8c>
c01059a4:	c7 44 24 0c 4d b5 10 	movl   $0xc010b54d,0xc(%esp)
c01059ab:	c0 
c01059ac:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01059b3:	c0 
c01059b4:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
c01059bb:	00 
c01059bc:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01059c3:	e8 75 aa ff ff       	call   c010043d <__panic>
        p->flags = p->property = 0;
c01059c8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01059cb:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
c01059d2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01059d5:	8b 50 08             	mov    0x8(%eax),%edx
c01059d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01059db:	89 50 04             	mov    %edx,0x4(%eax)
        set_page_ref(p, 0);
c01059de:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01059e5:	00 
c01059e6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01059e9:	89 04 24             	mov    %eax,(%esp)
c01059ec:	e8 0a ff ff ff       	call   c01058fb <set_page_ref>
    for (; p != base + n; p ++) {
c01059f1:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
c01059f5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01059f8:	c1 e0 05             	shl    $0x5,%eax
c01059fb:	89 c2                	mov    %eax,%edx
c01059fd:	8b 45 08             	mov    0x8(%ebp),%eax
c0105a00:	01 d0                	add    %edx,%eax
c0105a02:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0105a05:	0f 85 6d ff ff ff    	jne    c0105978 <default_init_memmap+0x3c>
    }
    base->property = n;
c0105a0b:	8b 45 08             	mov    0x8(%ebp),%eax
c0105a0e:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105a11:	89 50 08             	mov    %edx,0x8(%eax)
    SetPageProperty(base);
c0105a14:	8b 45 08             	mov    0x8(%ebp),%eax
c0105a17:	83 c0 04             	add    $0x4,%eax
c0105a1a:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0105a21:	89 45 cc             	mov    %eax,-0x34(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0105a24:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0105a27:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0105a2a:	0f ab 10             	bts    %edx,(%eax)
}
c0105a2d:	90                   	nop
    nr_free += n;
c0105a2e:	8b 15 34 e1 12 c0    	mov    0xc012e134,%edx
c0105a34:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105a37:	01 d0                	add    %edx,%eax
c0105a39:	a3 34 e1 12 c0       	mov    %eax,0xc012e134
    list_add_before(&free_list, &(base->page_link));
c0105a3e:	8b 45 08             	mov    0x8(%ebp),%eax
c0105a41:	83 c0 0c             	add    $0xc,%eax
c0105a44:	c7 45 e4 2c e1 12 c0 	movl   $0xc012e12c,-0x1c(%ebp)
c0105a4b:	89 45 e0             	mov    %eax,-0x20(%ebp)
    __list_add(elm, listelm->prev, listelm);
c0105a4e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105a51:	8b 00                	mov    (%eax),%eax
c0105a53:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105a56:	89 55 dc             	mov    %edx,-0x24(%ebp)
c0105a59:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0105a5c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105a5f:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    prev->next = next->prev = elm;
c0105a62:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0105a65:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0105a68:	89 10                	mov    %edx,(%eax)
c0105a6a:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0105a6d:	8b 10                	mov    (%eax),%edx
c0105a6f:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0105a72:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0105a75:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105a78:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0105a7b:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0105a7e:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105a81:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0105a84:	89 10                	mov    %edx,(%eax)
}
c0105a86:	90                   	nop
}
c0105a87:	90                   	nop
}
c0105a88:	90                   	nop
c0105a89:	c9                   	leave  
c0105a8a:	c3                   	ret    

c0105a8b <default_alloc_pages>:

static struct Page *
default_alloc_pages(size_t n) {
c0105a8b:	f3 0f 1e fb          	endbr32 
c0105a8f:	55                   	push   %ebp
c0105a90:	89 e5                	mov    %esp,%ebp
c0105a92:	83 ec 68             	sub    $0x68,%esp
    assert(n > 0);
c0105a95:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0105a99:	75 24                	jne    c0105abf <default_alloc_pages+0x34>
c0105a9b:	c7 44 24 0c 1c b5 10 	movl   $0xc010b51c,0xc(%esp)
c0105aa2:	c0 
c0105aa3:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0105aaa:	c0 
c0105aab:	c7 44 24 04 7c 00 00 	movl   $0x7c,0x4(%esp)
c0105ab2:	00 
c0105ab3:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0105aba:	e8 7e a9 ff ff       	call   c010043d <__panic>
    if (n > nr_free) {
c0105abf:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c0105ac4:	39 45 08             	cmp    %eax,0x8(%ebp)
c0105ac7:	76 0a                	jbe    c0105ad3 <default_alloc_pages+0x48>
        return NULL;
c0105ac9:	b8 00 00 00 00       	mov    $0x0,%eax
c0105ace:	e9 3c 01 00 00       	jmp    c0105c0f <default_alloc_pages+0x184>
    }
    struct Page *page = NULL;
c0105ad3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    list_entry_t *le = &free_list;
c0105ada:	c7 45 f0 2c e1 12 c0 	movl   $0xc012e12c,-0x10(%ebp)
    // TODO: optimize (next-fit)
    while ((le = list_next(le)) != &free_list) {
c0105ae1:	eb 1c                	jmp    c0105aff <default_alloc_pages+0x74>
        struct Page *p = le2page(le, page_link);
c0105ae3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105ae6:	83 e8 0c             	sub    $0xc,%eax
c0105ae9:	89 45 ec             	mov    %eax,-0x14(%ebp)
        if (p->property >= n) {
c0105aec:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105aef:	8b 40 08             	mov    0x8(%eax),%eax
c0105af2:	39 45 08             	cmp    %eax,0x8(%ebp)
c0105af5:	77 08                	ja     c0105aff <default_alloc_pages+0x74>
            page = p;
c0105af7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0105afa:	89 45 f4             	mov    %eax,-0xc(%ebp)
            break;
c0105afd:	eb 18                	jmp    c0105b17 <default_alloc_pages+0x8c>
c0105aff:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105b02:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return listelm->next;
c0105b05:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0105b08:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c0105b0b:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105b0e:	81 7d f0 2c e1 12 c0 	cmpl   $0xc012e12c,-0x10(%ebp)
c0105b15:	75 cc                	jne    c0105ae3 <default_alloc_pages+0x58>
        }
    }
    if (page != NULL) {
c0105b17:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105b1b:	0f 84 eb 00 00 00    	je     c0105c0c <default_alloc_pages+0x181>
        if (page->property > n) {
c0105b21:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b24:	8b 40 08             	mov    0x8(%eax),%eax
c0105b27:	39 45 08             	cmp    %eax,0x8(%ebp)
c0105b2a:	0f 83 88 00 00 00    	jae    c0105bb8 <default_alloc_pages+0x12d>
            struct Page *p = page + n;
c0105b30:	8b 45 08             	mov    0x8(%ebp),%eax
c0105b33:	c1 e0 05             	shl    $0x5,%eax
c0105b36:	89 c2                	mov    %eax,%edx
c0105b38:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b3b:	01 d0                	add    %edx,%eax
c0105b3d:	89 45 e8             	mov    %eax,-0x18(%ebp)
            p->property = page->property - n;
c0105b40:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105b43:	8b 40 08             	mov    0x8(%eax),%eax
c0105b46:	2b 45 08             	sub    0x8(%ebp),%eax
c0105b49:	89 c2                	mov    %eax,%edx
c0105b4b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105b4e:	89 50 08             	mov    %edx,0x8(%eax)
            SetPageProperty(p);
c0105b51:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105b54:	83 c0 04             	add    $0x4,%eax
c0105b57:	c7 45 cc 01 00 00 00 	movl   $0x1,-0x34(%ebp)
c0105b5e:	89 45 c8             	mov    %eax,-0x38(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0105b61:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0105b64:	8b 55 cc             	mov    -0x34(%ebp),%edx
c0105b67:	0f ab 10             	bts    %edx,(%eax)
}
c0105b6a:	90                   	nop
            list_add_after(&(page->page_link), &(p->page_link));
c0105b6b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105b6e:	83 c0 0c             	add    $0xc,%eax
c0105b71:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0105b74:	83 c2 0c             	add    $0xc,%edx
c0105b77:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0105b7a:	89 45 dc             	mov    %eax,-0x24(%ebp)
    __list_add(elm, listelm, listelm->next);
c0105b7d:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0105b80:	8b 40 04             	mov    0x4(%eax),%eax
c0105b83:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0105b86:	89 55 d8             	mov    %edx,-0x28(%ebp)
c0105b89:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105b8c:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0105b8f:	89 45 d0             	mov    %eax,-0x30(%ebp)
    prev->next = next->prev = elm;
c0105b92:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0105b95:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0105b98:	89 10                	mov    %edx,(%eax)
c0105b9a:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0105b9d:	8b 10                	mov    (%eax),%edx
c0105b9f:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0105ba2:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0105ba5:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0105ba8:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0105bab:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0105bae:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0105bb1:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0105bb4:	89 10                	mov    %edx,(%eax)
}
c0105bb6:	90                   	nop
}
c0105bb7:	90                   	nop
        }
        list_del(&(page->page_link));
c0105bb8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105bbb:	83 c0 0c             	add    $0xc,%eax
c0105bbe:	89 45 bc             	mov    %eax,-0x44(%ebp)
    __list_del(listelm->prev, listelm->next);
c0105bc1:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0105bc4:	8b 40 04             	mov    0x4(%eax),%eax
c0105bc7:	8b 55 bc             	mov    -0x44(%ebp),%edx
c0105bca:	8b 12                	mov    (%edx),%edx
c0105bcc:	89 55 b8             	mov    %edx,-0x48(%ebp)
c0105bcf:	89 45 b4             	mov    %eax,-0x4c(%ebp)
    prev->next = next;
c0105bd2:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0105bd5:	8b 55 b4             	mov    -0x4c(%ebp),%edx
c0105bd8:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0105bdb:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0105bde:	8b 55 b8             	mov    -0x48(%ebp),%edx
c0105be1:	89 10                	mov    %edx,(%eax)
}
c0105be3:	90                   	nop
}
c0105be4:	90                   	nop
        nr_free -= n;
c0105be5:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c0105bea:	2b 45 08             	sub    0x8(%ebp),%eax
c0105bed:	a3 34 e1 12 c0       	mov    %eax,0xc012e134
        ClearPageProperty(page);
c0105bf2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105bf5:	83 c0 04             	add    $0x4,%eax
c0105bf8:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
c0105bff:	89 45 c0             	mov    %eax,-0x40(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0105c02:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0105c05:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0105c08:	0f b3 10             	btr    %edx,(%eax)
}
c0105c0b:	90                   	nop
    }
    return page;
c0105c0c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0105c0f:	c9                   	leave  
c0105c10:	c3                   	ret    

c0105c11 <default_free_pages>:

static void
default_free_pages(struct Page *base, size_t n) {
c0105c11:	f3 0f 1e fb          	endbr32 
c0105c15:	55                   	push   %ebp
c0105c16:	89 e5                	mov    %esp,%ebp
c0105c18:	81 ec 98 00 00 00    	sub    $0x98,%esp
    assert(n > 0);
c0105c1e:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0105c22:	75 24                	jne    c0105c48 <default_free_pages+0x37>
c0105c24:	c7 44 24 0c 1c b5 10 	movl   $0xc010b51c,0xc(%esp)
c0105c2b:	c0 
c0105c2c:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0105c33:	c0 
c0105c34:	c7 44 24 04 9a 00 00 	movl   $0x9a,0x4(%esp)
c0105c3b:	00 
c0105c3c:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0105c43:	e8 f5 a7 ff ff       	call   c010043d <__panic>
    struct Page *p = base;
c0105c48:	8b 45 08             	mov    0x8(%ebp),%eax
c0105c4b:	89 45 f4             	mov    %eax,-0xc(%ebp)
    for (; p != base + n; p ++) {
c0105c4e:	e9 9d 00 00 00       	jmp    c0105cf0 <default_free_pages+0xdf>
        assert(!PageReserved(p) && !PageProperty(p));
c0105c53:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105c56:	83 c0 04             	add    $0x4,%eax
c0105c59:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
c0105c60:	89 45 e8             	mov    %eax,-0x18(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0105c63:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0105c66:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0105c69:	0f a3 10             	bt     %edx,(%eax)
c0105c6c:	19 c0                	sbb    %eax,%eax
c0105c6e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return oldbit != 0;
c0105c71:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0105c75:	0f 95 c0             	setne  %al
c0105c78:	0f b6 c0             	movzbl %al,%eax
c0105c7b:	85 c0                	test   %eax,%eax
c0105c7d:	75 2c                	jne    c0105cab <default_free_pages+0x9a>
c0105c7f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105c82:	83 c0 04             	add    $0x4,%eax
c0105c85:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
c0105c8c:	89 45 dc             	mov    %eax,-0x24(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0105c8f:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0105c92:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0105c95:	0f a3 10             	bt     %edx,(%eax)
c0105c98:	19 c0                	sbb    %eax,%eax
c0105c9a:	89 45 d8             	mov    %eax,-0x28(%ebp)
    return oldbit != 0;
c0105c9d:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
c0105ca1:	0f 95 c0             	setne  %al
c0105ca4:	0f b6 c0             	movzbl %al,%eax
c0105ca7:	85 c0                	test   %eax,%eax
c0105ca9:	74 24                	je     c0105ccf <default_free_pages+0xbe>
c0105cab:	c7 44 24 0c 60 b5 10 	movl   $0xc010b560,0xc(%esp)
c0105cb2:	c0 
c0105cb3:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0105cba:	c0 
c0105cbb:	c7 44 24 04 9d 00 00 	movl   $0x9d,0x4(%esp)
c0105cc2:	00 
c0105cc3:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0105cca:	e8 6e a7 ff ff       	call   c010043d <__panic>
        p->flags = 0;
c0105ccf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105cd2:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
        set_page_ref(p, 0);
c0105cd9:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0105ce0:	00 
c0105ce1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105ce4:	89 04 24             	mov    %eax,(%esp)
c0105ce7:	e8 0f fc ff ff       	call   c01058fb <set_page_ref>
    for (; p != base + n; p ++) {
c0105cec:	83 45 f4 20          	addl   $0x20,-0xc(%ebp)
c0105cf0:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105cf3:	c1 e0 05             	shl    $0x5,%eax
c0105cf6:	89 c2                	mov    %eax,%edx
c0105cf8:	8b 45 08             	mov    0x8(%ebp),%eax
c0105cfb:	01 d0                	add    %edx,%eax
c0105cfd:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0105d00:	0f 85 4d ff ff ff    	jne    c0105c53 <default_free_pages+0x42>
    }
    base->property = n;
c0105d06:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d09:	8b 55 0c             	mov    0xc(%ebp),%edx
c0105d0c:	89 50 08             	mov    %edx,0x8(%eax)
    SetPageProperty(base);
c0105d0f:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d12:	83 c0 04             	add    $0x4,%eax
c0105d15:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c0105d1c:	89 45 cc             	mov    %eax,-0x34(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0105d1f:	8b 45 cc             	mov    -0x34(%ebp),%eax
c0105d22:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0105d25:	0f ab 10             	bts    %edx,(%eax)
}
c0105d28:	90                   	nop
c0105d29:	c7 45 d4 2c e1 12 c0 	movl   $0xc012e12c,-0x2c(%ebp)
    return listelm->next;
c0105d30:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0105d33:	8b 40 04             	mov    0x4(%eax),%eax
    list_entry_t *le = list_next(&free_list);
c0105d36:	89 45 f0             	mov    %eax,-0x10(%ebp)
    while (le != &free_list) {
c0105d39:	e9 00 01 00 00       	jmp    c0105e3e <default_free_pages+0x22d>
        p = le2page(le, page_link);
c0105d3e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105d41:	83 e8 0c             	sub    $0xc,%eax
c0105d44:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105d47:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105d4a:	89 45 c8             	mov    %eax,-0x38(%ebp)
c0105d4d:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0105d50:	8b 40 04             	mov    0x4(%eax),%eax
        le = list_next(le);
c0105d53:	89 45 f0             	mov    %eax,-0x10(%ebp)
        // TODO: optimize
        if (base + base->property == p) {
c0105d56:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d59:	8b 40 08             	mov    0x8(%eax),%eax
c0105d5c:	c1 e0 05             	shl    $0x5,%eax
c0105d5f:	89 c2                	mov    %eax,%edx
c0105d61:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d64:	01 d0                	add    %edx,%eax
c0105d66:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0105d69:	75 5d                	jne    c0105dc8 <default_free_pages+0x1b7>
            base->property += p->property;
c0105d6b:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d6e:	8b 50 08             	mov    0x8(%eax),%edx
c0105d71:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105d74:	8b 40 08             	mov    0x8(%eax),%eax
c0105d77:	01 c2                	add    %eax,%edx
c0105d79:	8b 45 08             	mov    0x8(%ebp),%eax
c0105d7c:	89 50 08             	mov    %edx,0x8(%eax)
            ClearPageProperty(p);
c0105d7f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105d82:	83 c0 04             	add    $0x4,%eax
c0105d85:	c7 45 b8 01 00 00 00 	movl   $0x1,-0x48(%ebp)
c0105d8c:	89 45 b4             	mov    %eax,-0x4c(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0105d8f:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0105d92:	8b 55 b8             	mov    -0x48(%ebp),%edx
c0105d95:	0f b3 10             	btr    %edx,(%eax)
}
c0105d98:	90                   	nop
            list_del(&(p->page_link));
c0105d99:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105d9c:	83 c0 0c             	add    $0xc,%eax
c0105d9f:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    __list_del(listelm->prev, listelm->next);
c0105da2:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0105da5:	8b 40 04             	mov    0x4(%eax),%eax
c0105da8:	8b 55 c4             	mov    -0x3c(%ebp),%edx
c0105dab:	8b 12                	mov    (%edx),%edx
c0105dad:	89 55 c0             	mov    %edx,-0x40(%ebp)
c0105db0:	89 45 bc             	mov    %eax,-0x44(%ebp)
    prev->next = next;
c0105db3:	8b 45 c0             	mov    -0x40(%ebp),%eax
c0105db6:	8b 55 bc             	mov    -0x44(%ebp),%edx
c0105db9:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0105dbc:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0105dbf:	8b 55 c0             	mov    -0x40(%ebp),%edx
c0105dc2:	89 10                	mov    %edx,(%eax)
}
c0105dc4:	90                   	nop
}
c0105dc5:	90                   	nop
c0105dc6:	eb 76                	jmp    c0105e3e <default_free_pages+0x22d>
        }
        else if (p + p->property == base) {
c0105dc8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dcb:	8b 40 08             	mov    0x8(%eax),%eax
c0105dce:	c1 e0 05             	shl    $0x5,%eax
c0105dd1:	89 c2                	mov    %eax,%edx
c0105dd3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dd6:	01 d0                	add    %edx,%eax
c0105dd8:	39 45 08             	cmp    %eax,0x8(%ebp)
c0105ddb:	75 61                	jne    c0105e3e <default_free_pages+0x22d>
            p->property += base->property;
c0105ddd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105de0:	8b 50 08             	mov    0x8(%eax),%edx
c0105de3:	8b 45 08             	mov    0x8(%ebp),%eax
c0105de6:	8b 40 08             	mov    0x8(%eax),%eax
c0105de9:	01 c2                	add    %eax,%edx
c0105deb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105dee:	89 50 08             	mov    %edx,0x8(%eax)
            ClearPageProperty(base);
c0105df1:	8b 45 08             	mov    0x8(%ebp),%eax
c0105df4:	83 c0 04             	add    $0x4,%eax
c0105df7:	c7 45 a4 01 00 00 00 	movl   $0x1,-0x5c(%ebp)
c0105dfe:	89 45 a0             	mov    %eax,-0x60(%ebp)
    asm volatile ("btrl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c0105e01:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0105e04:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0105e07:	0f b3 10             	btr    %edx,(%eax)
}
c0105e0a:	90                   	nop
            base = p;
c0105e0b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105e0e:	89 45 08             	mov    %eax,0x8(%ebp)
            list_del(&(p->page_link));
c0105e11:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105e14:	83 c0 0c             	add    $0xc,%eax
c0105e17:	89 45 b0             	mov    %eax,-0x50(%ebp)
    __list_del(listelm->prev, listelm->next);
c0105e1a:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0105e1d:	8b 40 04             	mov    0x4(%eax),%eax
c0105e20:	8b 55 b0             	mov    -0x50(%ebp),%edx
c0105e23:	8b 12                	mov    (%edx),%edx
c0105e25:	89 55 ac             	mov    %edx,-0x54(%ebp)
c0105e28:	89 45 a8             	mov    %eax,-0x58(%ebp)
    prev->next = next;
c0105e2b:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0105e2e:	8b 55 a8             	mov    -0x58(%ebp),%edx
c0105e31:	89 50 04             	mov    %edx,0x4(%eax)
    next->prev = prev;
c0105e34:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0105e37:	8b 55 ac             	mov    -0x54(%ebp),%edx
c0105e3a:	89 10                	mov    %edx,(%eax)
}
c0105e3c:	90                   	nop
}
c0105e3d:	90                   	nop
    while (le != &free_list) {
c0105e3e:	81 7d f0 2c e1 12 c0 	cmpl   $0xc012e12c,-0x10(%ebp)
c0105e45:	0f 85 f3 fe ff ff    	jne    c0105d3e <default_free_pages+0x12d>
        }
    }
    nr_free += n;
c0105e4b:	8b 15 34 e1 12 c0    	mov    0xc012e134,%edx
c0105e51:	8b 45 0c             	mov    0xc(%ebp),%eax
c0105e54:	01 d0                	add    %edx,%eax
c0105e56:	a3 34 e1 12 c0       	mov    %eax,0xc012e134
c0105e5b:	c7 45 9c 2c e1 12 c0 	movl   $0xc012e12c,-0x64(%ebp)
    return listelm->next;
c0105e62:	8b 45 9c             	mov    -0x64(%ebp),%eax
c0105e65:	8b 40 04             	mov    0x4(%eax),%eax
    le = list_next(&free_list);
c0105e68:	89 45 f0             	mov    %eax,-0x10(%ebp)
    while (le != &free_list) {
c0105e6b:	eb 66                	jmp    c0105ed3 <default_free_pages+0x2c2>
        p = le2page(le, page_link);
c0105e6d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105e70:	83 e8 0c             	sub    $0xc,%eax
c0105e73:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (base + base->property <= p) {
c0105e76:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e79:	8b 40 08             	mov    0x8(%eax),%eax
c0105e7c:	c1 e0 05             	shl    $0x5,%eax
c0105e7f:	89 c2                	mov    %eax,%edx
c0105e81:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e84:	01 d0                	add    %edx,%eax
c0105e86:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0105e89:	72 39                	jb     c0105ec4 <default_free_pages+0x2b3>
            assert(base + base->property != p);
c0105e8b:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e8e:	8b 40 08             	mov    0x8(%eax),%eax
c0105e91:	c1 e0 05             	shl    $0x5,%eax
c0105e94:	89 c2                	mov    %eax,%edx
c0105e96:	8b 45 08             	mov    0x8(%ebp),%eax
c0105e99:	01 d0                	add    %edx,%eax
c0105e9b:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0105e9e:	75 3e                	jne    c0105ede <default_free_pages+0x2cd>
c0105ea0:	c7 44 24 0c 85 b5 10 	movl   $0xc010b585,0xc(%esp)
c0105ea7:	c0 
c0105ea8:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0105eaf:	c0 
c0105eb0:	c7 44 24 04 b9 00 00 	movl   $0xb9,0x4(%esp)
c0105eb7:	00 
c0105eb8:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0105ebf:	e8 79 a5 ff ff       	call   c010043d <__panic>
c0105ec4:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105ec7:	89 45 98             	mov    %eax,-0x68(%ebp)
c0105eca:	8b 45 98             	mov    -0x68(%ebp),%eax
c0105ecd:	8b 40 04             	mov    0x4(%eax),%eax
            break;
        }
        le = list_next(le);
c0105ed0:	89 45 f0             	mov    %eax,-0x10(%ebp)
    while (le != &free_list) {
c0105ed3:	81 7d f0 2c e1 12 c0 	cmpl   $0xc012e12c,-0x10(%ebp)
c0105eda:	75 91                	jne    c0105e6d <default_free_pages+0x25c>
c0105edc:	eb 01                	jmp    c0105edf <default_free_pages+0x2ce>
            break;
c0105ede:	90                   	nop
    }
    list_add_before(le, &(base->page_link));
c0105edf:	8b 45 08             	mov    0x8(%ebp),%eax
c0105ee2:	8d 50 0c             	lea    0xc(%eax),%edx
c0105ee5:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105ee8:	89 45 94             	mov    %eax,-0x6c(%ebp)
c0105eeb:	89 55 90             	mov    %edx,-0x70(%ebp)
    __list_add(elm, listelm->prev, listelm);
c0105eee:	8b 45 94             	mov    -0x6c(%ebp),%eax
c0105ef1:	8b 00                	mov    (%eax),%eax
c0105ef3:	8b 55 90             	mov    -0x70(%ebp),%edx
c0105ef6:	89 55 8c             	mov    %edx,-0x74(%ebp)
c0105ef9:	89 45 88             	mov    %eax,-0x78(%ebp)
c0105efc:	8b 45 94             	mov    -0x6c(%ebp),%eax
c0105eff:	89 45 84             	mov    %eax,-0x7c(%ebp)
    prev->next = next->prev = elm;
c0105f02:	8b 45 84             	mov    -0x7c(%ebp),%eax
c0105f05:	8b 55 8c             	mov    -0x74(%ebp),%edx
c0105f08:	89 10                	mov    %edx,(%eax)
c0105f0a:	8b 45 84             	mov    -0x7c(%ebp),%eax
c0105f0d:	8b 10                	mov    (%eax),%edx
c0105f0f:	8b 45 88             	mov    -0x78(%ebp),%eax
c0105f12:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0105f15:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0105f18:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0105f1b:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0105f1e:	8b 45 8c             	mov    -0x74(%ebp),%eax
c0105f21:	8b 55 88             	mov    -0x78(%ebp),%edx
c0105f24:	89 10                	mov    %edx,(%eax)
}
c0105f26:	90                   	nop
}
c0105f27:	90                   	nop
}
c0105f28:	90                   	nop
c0105f29:	c9                   	leave  
c0105f2a:	c3                   	ret    

c0105f2b <default_nr_free_pages>:

static size_t
default_nr_free_pages(void) {
c0105f2b:	f3 0f 1e fb          	endbr32 
c0105f2f:	55                   	push   %ebp
c0105f30:	89 e5                	mov    %esp,%ebp
    return nr_free;
c0105f32:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
}
c0105f37:	5d                   	pop    %ebp
c0105f38:	c3                   	ret    

c0105f39 <basic_check>:

static void
basic_check(void) {
c0105f39:	f3 0f 1e fb          	endbr32 
c0105f3d:	55                   	push   %ebp
c0105f3e:	89 e5                	mov    %esp,%ebp
c0105f40:	83 ec 48             	sub    $0x48,%esp
    struct Page *p0, *p1, *p2;
    p0 = p1 = p2 = NULL;
c0105f43:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0105f4a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0105f4d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105f50:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0105f53:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert((p0 = alloc_page()) != NULL);
c0105f56:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105f5d:	e8 9c 0e 00 00       	call   c0106dfe <alloc_pages>
c0105f62:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0105f65:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c0105f69:	75 24                	jne    c0105f8f <basic_check+0x56>
c0105f6b:	c7 44 24 0c a0 b5 10 	movl   $0xc010b5a0,0xc(%esp)
c0105f72:	c0 
c0105f73:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0105f7a:	c0 
c0105f7b:	c7 44 24 04 ca 00 00 	movl   $0xca,0x4(%esp)
c0105f82:	00 
c0105f83:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0105f8a:	e8 ae a4 ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_page()) != NULL);
c0105f8f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105f96:	e8 63 0e 00 00       	call   c0106dfe <alloc_pages>
c0105f9b:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0105f9e:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0105fa2:	75 24                	jne    c0105fc8 <basic_check+0x8f>
c0105fa4:	c7 44 24 0c bc b5 10 	movl   $0xc010b5bc,0xc(%esp)
c0105fab:	c0 
c0105fac:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0105fb3:	c0 
c0105fb4:	c7 44 24 04 cb 00 00 	movl   $0xcb,0x4(%esp)
c0105fbb:	00 
c0105fbc:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0105fc3:	e8 75 a4 ff ff       	call   c010043d <__panic>
    assert((p2 = alloc_page()) != NULL);
c0105fc8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0105fcf:	e8 2a 0e 00 00       	call   c0106dfe <alloc_pages>
c0105fd4:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0105fd7:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0105fdb:	75 24                	jne    c0106001 <basic_check+0xc8>
c0105fdd:	c7 44 24 0c d8 b5 10 	movl   $0xc010b5d8,0xc(%esp)
c0105fe4:	c0 
c0105fe5:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0105fec:	c0 
c0105fed:	c7 44 24 04 cc 00 00 	movl   $0xcc,0x4(%esp)
c0105ff4:	00 
c0105ff5:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0105ffc:	e8 3c a4 ff ff       	call   c010043d <__panic>

    assert(p0 != p1 && p0 != p2 && p1 != p2);
c0106001:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106004:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0106007:	74 10                	je     c0106019 <basic_check+0xe0>
c0106009:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010600c:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c010600f:	74 08                	je     c0106019 <basic_check+0xe0>
c0106011:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106014:	3b 45 f4             	cmp    -0xc(%ebp),%eax
c0106017:	75 24                	jne    c010603d <basic_check+0x104>
c0106019:	c7 44 24 0c f4 b5 10 	movl   $0xc010b5f4,0xc(%esp)
c0106020:	c0 
c0106021:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106028:	c0 
c0106029:	c7 44 24 04 ce 00 00 	movl   $0xce,0x4(%esp)
c0106030:	00 
c0106031:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106038:	e8 00 a4 ff ff       	call   c010043d <__panic>
    assert(page_ref(p0) == 0 && page_ref(p1) == 0 && page_ref(p2) == 0);
c010603d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106040:	89 04 24             	mov    %eax,(%esp)
c0106043:	e8 a9 f8 ff ff       	call   c01058f1 <page_ref>
c0106048:	85 c0                	test   %eax,%eax
c010604a:	75 1e                	jne    c010606a <basic_check+0x131>
c010604c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010604f:	89 04 24             	mov    %eax,(%esp)
c0106052:	e8 9a f8 ff ff       	call   c01058f1 <page_ref>
c0106057:	85 c0                	test   %eax,%eax
c0106059:	75 0f                	jne    c010606a <basic_check+0x131>
c010605b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010605e:	89 04 24             	mov    %eax,(%esp)
c0106061:	e8 8b f8 ff ff       	call   c01058f1 <page_ref>
c0106066:	85 c0                	test   %eax,%eax
c0106068:	74 24                	je     c010608e <basic_check+0x155>
c010606a:	c7 44 24 0c 18 b6 10 	movl   $0xc010b618,0xc(%esp)
c0106071:	c0 
c0106072:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106079:	c0 
c010607a:	c7 44 24 04 cf 00 00 	movl   $0xcf,0x4(%esp)
c0106081:	00 
c0106082:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106089:	e8 af a3 ff ff       	call   c010043d <__panic>

    assert(page2pa(p0) < npage * PGSIZE);
c010608e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106091:	89 04 24             	mov    %eax,(%esp)
c0106094:	e8 42 f8 ff ff       	call   c01058db <page2pa>
c0106099:	8b 15 80 bf 12 c0    	mov    0xc012bf80,%edx
c010609f:	c1 e2 0c             	shl    $0xc,%edx
c01060a2:	39 d0                	cmp    %edx,%eax
c01060a4:	72 24                	jb     c01060ca <basic_check+0x191>
c01060a6:	c7 44 24 0c 54 b6 10 	movl   $0xc010b654,0xc(%esp)
c01060ad:	c0 
c01060ae:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01060b5:	c0 
c01060b6:	c7 44 24 04 d1 00 00 	movl   $0xd1,0x4(%esp)
c01060bd:	00 
c01060be:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01060c5:	e8 73 a3 ff ff       	call   c010043d <__panic>
    assert(page2pa(p1) < npage * PGSIZE);
c01060ca:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01060cd:	89 04 24             	mov    %eax,(%esp)
c01060d0:	e8 06 f8 ff ff       	call   c01058db <page2pa>
c01060d5:	8b 15 80 bf 12 c0    	mov    0xc012bf80,%edx
c01060db:	c1 e2 0c             	shl    $0xc,%edx
c01060de:	39 d0                	cmp    %edx,%eax
c01060e0:	72 24                	jb     c0106106 <basic_check+0x1cd>
c01060e2:	c7 44 24 0c 71 b6 10 	movl   $0xc010b671,0xc(%esp)
c01060e9:	c0 
c01060ea:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01060f1:	c0 
c01060f2:	c7 44 24 04 d2 00 00 	movl   $0xd2,0x4(%esp)
c01060f9:	00 
c01060fa:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106101:	e8 37 a3 ff ff       	call   c010043d <__panic>
    assert(page2pa(p2) < npage * PGSIZE);
c0106106:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106109:	89 04 24             	mov    %eax,(%esp)
c010610c:	e8 ca f7 ff ff       	call   c01058db <page2pa>
c0106111:	8b 15 80 bf 12 c0    	mov    0xc012bf80,%edx
c0106117:	c1 e2 0c             	shl    $0xc,%edx
c010611a:	39 d0                	cmp    %edx,%eax
c010611c:	72 24                	jb     c0106142 <basic_check+0x209>
c010611e:	c7 44 24 0c 8e b6 10 	movl   $0xc010b68e,0xc(%esp)
c0106125:	c0 
c0106126:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c010612d:	c0 
c010612e:	c7 44 24 04 d3 00 00 	movl   $0xd3,0x4(%esp)
c0106135:	00 
c0106136:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c010613d:	e8 fb a2 ff ff       	call   c010043d <__panic>

    list_entry_t free_list_store = free_list;
c0106142:	a1 2c e1 12 c0       	mov    0xc012e12c,%eax
c0106147:	8b 15 30 e1 12 c0    	mov    0xc012e130,%edx
c010614d:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0106150:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0106153:	c7 45 dc 2c e1 12 c0 	movl   $0xc012e12c,-0x24(%ebp)
    elm->prev = elm->next = elm;
c010615a:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010615d:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0106160:	89 50 04             	mov    %edx,0x4(%eax)
c0106163:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106166:	8b 50 04             	mov    0x4(%eax),%edx
c0106169:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010616c:	89 10                	mov    %edx,(%eax)
}
c010616e:	90                   	nop
c010616f:	c7 45 e0 2c e1 12 c0 	movl   $0xc012e12c,-0x20(%ebp)
    return list->next == list;
c0106176:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106179:	8b 40 04             	mov    0x4(%eax),%eax
c010617c:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c010617f:	0f 94 c0             	sete   %al
c0106182:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c0106185:	85 c0                	test   %eax,%eax
c0106187:	75 24                	jne    c01061ad <basic_check+0x274>
c0106189:	c7 44 24 0c ab b6 10 	movl   $0xc010b6ab,0xc(%esp)
c0106190:	c0 
c0106191:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106198:	c0 
c0106199:	c7 44 24 04 d7 00 00 	movl   $0xd7,0x4(%esp)
c01061a0:	00 
c01061a1:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01061a8:	e8 90 a2 ff ff       	call   c010043d <__panic>

    unsigned int nr_free_store = nr_free;
c01061ad:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c01061b2:	89 45 e8             	mov    %eax,-0x18(%ebp)
    nr_free = 0;
c01061b5:	c7 05 34 e1 12 c0 00 	movl   $0x0,0xc012e134
c01061bc:	00 00 00 

    assert(alloc_page() == NULL);
c01061bf:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01061c6:	e8 33 0c 00 00       	call   c0106dfe <alloc_pages>
c01061cb:	85 c0                	test   %eax,%eax
c01061cd:	74 24                	je     c01061f3 <basic_check+0x2ba>
c01061cf:	c7 44 24 0c c2 b6 10 	movl   $0xc010b6c2,0xc(%esp)
c01061d6:	c0 
c01061d7:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01061de:	c0 
c01061df:	c7 44 24 04 dc 00 00 	movl   $0xdc,0x4(%esp)
c01061e6:	00 
c01061e7:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01061ee:	e8 4a a2 ff ff       	call   c010043d <__panic>

    free_page(p0);
c01061f3:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01061fa:	00 
c01061fb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01061fe:	89 04 24             	mov    %eax,(%esp)
c0106201:	e8 67 0c 00 00       	call   c0106e6d <free_pages>
    free_page(p1);
c0106206:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010620d:	00 
c010620e:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106211:	89 04 24             	mov    %eax,(%esp)
c0106214:	e8 54 0c 00 00       	call   c0106e6d <free_pages>
    free_page(p2);
c0106219:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106220:	00 
c0106221:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106224:	89 04 24             	mov    %eax,(%esp)
c0106227:	e8 41 0c 00 00       	call   c0106e6d <free_pages>
    assert(nr_free == 3);
c010622c:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c0106231:	83 f8 03             	cmp    $0x3,%eax
c0106234:	74 24                	je     c010625a <basic_check+0x321>
c0106236:	c7 44 24 0c d7 b6 10 	movl   $0xc010b6d7,0xc(%esp)
c010623d:	c0 
c010623e:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106245:	c0 
c0106246:	c7 44 24 04 e1 00 00 	movl   $0xe1,0x4(%esp)
c010624d:	00 
c010624e:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106255:	e8 e3 a1 ff ff       	call   c010043d <__panic>

    assert((p0 = alloc_page()) != NULL);
c010625a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106261:	e8 98 0b 00 00       	call   c0106dfe <alloc_pages>
c0106266:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106269:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
c010626d:	75 24                	jne    c0106293 <basic_check+0x35a>
c010626f:	c7 44 24 0c a0 b5 10 	movl   $0xc010b5a0,0xc(%esp)
c0106276:	c0 
c0106277:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c010627e:	c0 
c010627f:	c7 44 24 04 e3 00 00 	movl   $0xe3,0x4(%esp)
c0106286:	00 
c0106287:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c010628e:	e8 aa a1 ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_page()) != NULL);
c0106293:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010629a:	e8 5f 0b 00 00       	call   c0106dfe <alloc_pages>
c010629f:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01062a2:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01062a6:	75 24                	jne    c01062cc <basic_check+0x393>
c01062a8:	c7 44 24 0c bc b5 10 	movl   $0xc010b5bc,0xc(%esp)
c01062af:	c0 
c01062b0:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01062b7:	c0 
c01062b8:	c7 44 24 04 e4 00 00 	movl   $0xe4,0x4(%esp)
c01062bf:	00 
c01062c0:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01062c7:	e8 71 a1 ff ff       	call   c010043d <__panic>
    assert((p2 = alloc_page()) != NULL);
c01062cc:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01062d3:	e8 26 0b 00 00       	call   c0106dfe <alloc_pages>
c01062d8:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01062db:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01062df:	75 24                	jne    c0106305 <basic_check+0x3cc>
c01062e1:	c7 44 24 0c d8 b5 10 	movl   $0xc010b5d8,0xc(%esp)
c01062e8:	c0 
c01062e9:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01062f0:	c0 
c01062f1:	c7 44 24 04 e5 00 00 	movl   $0xe5,0x4(%esp)
c01062f8:	00 
c01062f9:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106300:	e8 38 a1 ff ff       	call   c010043d <__panic>

    assert(alloc_page() == NULL);
c0106305:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010630c:	e8 ed 0a 00 00       	call   c0106dfe <alloc_pages>
c0106311:	85 c0                	test   %eax,%eax
c0106313:	74 24                	je     c0106339 <basic_check+0x400>
c0106315:	c7 44 24 0c c2 b6 10 	movl   $0xc010b6c2,0xc(%esp)
c010631c:	c0 
c010631d:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106324:	c0 
c0106325:	c7 44 24 04 e7 00 00 	movl   $0xe7,0x4(%esp)
c010632c:	00 
c010632d:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106334:	e8 04 a1 ff ff       	call   c010043d <__panic>

    free_page(p0);
c0106339:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106340:	00 
c0106341:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106344:	89 04 24             	mov    %eax,(%esp)
c0106347:	e8 21 0b 00 00       	call   c0106e6d <free_pages>
c010634c:	c7 45 d8 2c e1 12 c0 	movl   $0xc012e12c,-0x28(%ebp)
c0106353:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0106356:	8b 40 04             	mov    0x4(%eax),%eax
c0106359:	39 45 d8             	cmp    %eax,-0x28(%ebp)
c010635c:	0f 94 c0             	sete   %al
c010635f:	0f b6 c0             	movzbl %al,%eax
    assert(!list_empty(&free_list));
c0106362:	85 c0                	test   %eax,%eax
c0106364:	74 24                	je     c010638a <basic_check+0x451>
c0106366:	c7 44 24 0c e4 b6 10 	movl   $0xc010b6e4,0xc(%esp)
c010636d:	c0 
c010636e:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106375:	c0 
c0106376:	c7 44 24 04 ea 00 00 	movl   $0xea,0x4(%esp)
c010637d:	00 
c010637e:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106385:	e8 b3 a0 ff ff       	call   c010043d <__panic>

    struct Page *p;
    assert((p = alloc_page()) == p0);
c010638a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106391:	e8 68 0a 00 00       	call   c0106dfe <alloc_pages>
c0106396:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0106399:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010639c:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c010639f:	74 24                	je     c01063c5 <basic_check+0x48c>
c01063a1:	c7 44 24 0c fc b6 10 	movl   $0xc010b6fc,0xc(%esp)
c01063a8:	c0 
c01063a9:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01063b0:	c0 
c01063b1:	c7 44 24 04 ed 00 00 	movl   $0xed,0x4(%esp)
c01063b8:	00 
c01063b9:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01063c0:	e8 78 a0 ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c01063c5:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01063cc:	e8 2d 0a 00 00       	call   c0106dfe <alloc_pages>
c01063d1:	85 c0                	test   %eax,%eax
c01063d3:	74 24                	je     c01063f9 <basic_check+0x4c0>
c01063d5:	c7 44 24 0c c2 b6 10 	movl   $0xc010b6c2,0xc(%esp)
c01063dc:	c0 
c01063dd:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01063e4:	c0 
c01063e5:	c7 44 24 04 ee 00 00 	movl   $0xee,0x4(%esp)
c01063ec:	00 
c01063ed:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01063f4:	e8 44 a0 ff ff       	call   c010043d <__panic>

    assert(nr_free == 0);
c01063f9:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c01063fe:	85 c0                	test   %eax,%eax
c0106400:	74 24                	je     c0106426 <basic_check+0x4ed>
c0106402:	c7 44 24 0c 15 b7 10 	movl   $0xc010b715,0xc(%esp)
c0106409:	c0 
c010640a:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106411:	c0 
c0106412:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
c0106419:	00 
c010641a:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106421:	e8 17 a0 ff ff       	call   c010043d <__panic>
    free_list = free_list_store;
c0106426:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0106429:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010642c:	a3 2c e1 12 c0       	mov    %eax,0xc012e12c
c0106431:	89 15 30 e1 12 c0    	mov    %edx,0xc012e130
    nr_free = nr_free_store;
c0106437:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010643a:	a3 34 e1 12 c0       	mov    %eax,0xc012e134

    free_page(p);
c010643f:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106446:	00 
c0106447:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010644a:	89 04 24             	mov    %eax,(%esp)
c010644d:	e8 1b 0a 00 00       	call   c0106e6d <free_pages>
    free_page(p1);
c0106452:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106459:	00 
c010645a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010645d:	89 04 24             	mov    %eax,(%esp)
c0106460:	e8 08 0a 00 00       	call   c0106e6d <free_pages>
    free_page(p2);
c0106465:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010646c:	00 
c010646d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106470:	89 04 24             	mov    %eax,(%esp)
c0106473:	e8 f5 09 00 00       	call   c0106e6d <free_pages>
}
c0106478:	90                   	nop
c0106479:	c9                   	leave  
c010647a:	c3                   	ret    

c010647b <default_check>:

// LAB2: below code is used to check the first fit allocation algorithm (your EXERCISE 1) 
// NOTICE: You SHOULD NOT CHANGE basic_check, default_check functions!
static void
default_check(void) {
c010647b:	f3 0f 1e fb          	endbr32 
c010647f:	55                   	push   %ebp
c0106480:	89 e5                	mov    %esp,%ebp
c0106482:	81 ec 98 00 00 00    	sub    $0x98,%esp
    int count = 0, total = 0;
c0106488:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c010648f:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    list_entry_t *le = &free_list;
c0106496:	c7 45 ec 2c e1 12 c0 	movl   $0xc012e12c,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c010649d:	eb 6a                	jmp    c0106509 <default_check+0x8e>
        struct Page *p = le2page(le, page_link);
c010649f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01064a2:	83 e8 0c             	sub    $0xc,%eax
c01064a5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        assert(PageProperty(p));
c01064a8:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01064ab:	83 c0 04             	add    $0x4,%eax
c01064ae:	c7 45 d0 01 00 00 00 	movl   $0x1,-0x30(%ebp)
c01064b5:	89 45 cc             	mov    %eax,-0x34(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01064b8:	8b 45 cc             	mov    -0x34(%ebp),%eax
c01064bb:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01064be:	0f a3 10             	bt     %edx,(%eax)
c01064c1:	19 c0                	sbb    %eax,%eax
c01064c3:	89 45 c8             	mov    %eax,-0x38(%ebp)
    return oldbit != 0;
c01064c6:	83 7d c8 00          	cmpl   $0x0,-0x38(%ebp)
c01064ca:	0f 95 c0             	setne  %al
c01064cd:	0f b6 c0             	movzbl %al,%eax
c01064d0:	85 c0                	test   %eax,%eax
c01064d2:	75 24                	jne    c01064f8 <default_check+0x7d>
c01064d4:	c7 44 24 0c 22 b7 10 	movl   $0xc010b722,0xc(%esp)
c01064db:	c0 
c01064dc:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01064e3:	c0 
c01064e4:	c7 44 24 04 01 01 00 	movl   $0x101,0x4(%esp)
c01064eb:	00 
c01064ec:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01064f3:	e8 45 9f ff ff       	call   c010043d <__panic>
        count ++, total += p->property;
c01064f8:	ff 45 f4             	incl   -0xc(%ebp)
c01064fb:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c01064fe:	8b 50 08             	mov    0x8(%eax),%edx
c0106501:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106504:	01 d0                	add    %edx,%eax
c0106506:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106509:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010650c:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    return listelm->next;
c010650f:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0106512:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c0106515:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106518:	81 7d ec 2c e1 12 c0 	cmpl   $0xc012e12c,-0x14(%ebp)
c010651f:	0f 85 7a ff ff ff    	jne    c010649f <default_check+0x24>
    }
    assert(total == nr_free_pages());
c0106525:	e8 7a 09 00 00       	call   c0106ea4 <nr_free_pages>
c010652a:	8b 55 f0             	mov    -0x10(%ebp),%edx
c010652d:	39 d0                	cmp    %edx,%eax
c010652f:	74 24                	je     c0106555 <default_check+0xda>
c0106531:	c7 44 24 0c 32 b7 10 	movl   $0xc010b732,0xc(%esp)
c0106538:	c0 
c0106539:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106540:	c0 
c0106541:	c7 44 24 04 04 01 00 	movl   $0x104,0x4(%esp)
c0106548:	00 
c0106549:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106550:	e8 e8 9e ff ff       	call   c010043d <__panic>

    basic_check();
c0106555:	e8 df f9 ff ff       	call   c0105f39 <basic_check>

    struct Page *p0 = alloc_pages(5), *p1, *p2;
c010655a:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c0106561:	e8 98 08 00 00       	call   c0106dfe <alloc_pages>
c0106566:	89 45 e8             	mov    %eax,-0x18(%ebp)
    assert(p0 != NULL);
c0106569:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010656d:	75 24                	jne    c0106593 <default_check+0x118>
c010656f:	c7 44 24 0c 4b b7 10 	movl   $0xc010b74b,0xc(%esp)
c0106576:	c0 
c0106577:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c010657e:	c0 
c010657f:	c7 44 24 04 09 01 00 	movl   $0x109,0x4(%esp)
c0106586:	00 
c0106587:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c010658e:	e8 aa 9e ff ff       	call   c010043d <__panic>
    assert(!PageProperty(p0));
c0106593:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106596:	83 c0 04             	add    $0x4,%eax
c0106599:	c7 45 c0 01 00 00 00 	movl   $0x1,-0x40(%ebp)
c01065a0:	89 45 bc             	mov    %eax,-0x44(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01065a3:	8b 45 bc             	mov    -0x44(%ebp),%eax
c01065a6:	8b 55 c0             	mov    -0x40(%ebp),%edx
c01065a9:	0f a3 10             	bt     %edx,(%eax)
c01065ac:	19 c0                	sbb    %eax,%eax
c01065ae:	89 45 b8             	mov    %eax,-0x48(%ebp)
    return oldbit != 0;
c01065b1:	83 7d b8 00          	cmpl   $0x0,-0x48(%ebp)
c01065b5:	0f 95 c0             	setne  %al
c01065b8:	0f b6 c0             	movzbl %al,%eax
c01065bb:	85 c0                	test   %eax,%eax
c01065bd:	74 24                	je     c01065e3 <default_check+0x168>
c01065bf:	c7 44 24 0c 56 b7 10 	movl   $0xc010b756,0xc(%esp)
c01065c6:	c0 
c01065c7:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01065ce:	c0 
c01065cf:	c7 44 24 04 0a 01 00 	movl   $0x10a,0x4(%esp)
c01065d6:	00 
c01065d7:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01065de:	e8 5a 9e ff ff       	call   c010043d <__panic>

    list_entry_t free_list_store = free_list;
c01065e3:	a1 2c e1 12 c0       	mov    0xc012e12c,%eax
c01065e8:	8b 15 30 e1 12 c0    	mov    0xc012e130,%edx
c01065ee:	89 45 80             	mov    %eax,-0x80(%ebp)
c01065f1:	89 55 84             	mov    %edx,-0x7c(%ebp)
c01065f4:	c7 45 b0 2c e1 12 c0 	movl   $0xc012e12c,-0x50(%ebp)
    elm->prev = elm->next = elm;
c01065fb:	8b 45 b0             	mov    -0x50(%ebp),%eax
c01065fe:	8b 55 b0             	mov    -0x50(%ebp),%edx
c0106601:	89 50 04             	mov    %edx,0x4(%eax)
c0106604:	8b 45 b0             	mov    -0x50(%ebp),%eax
c0106607:	8b 50 04             	mov    0x4(%eax),%edx
c010660a:	8b 45 b0             	mov    -0x50(%ebp),%eax
c010660d:	89 10                	mov    %edx,(%eax)
}
c010660f:	90                   	nop
c0106610:	c7 45 b4 2c e1 12 c0 	movl   $0xc012e12c,-0x4c(%ebp)
    return list->next == list;
c0106617:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c010661a:	8b 40 04             	mov    0x4(%eax),%eax
c010661d:	39 45 b4             	cmp    %eax,-0x4c(%ebp)
c0106620:	0f 94 c0             	sete   %al
c0106623:	0f b6 c0             	movzbl %al,%eax
    list_init(&free_list);
    assert(list_empty(&free_list));
c0106626:	85 c0                	test   %eax,%eax
c0106628:	75 24                	jne    c010664e <default_check+0x1d3>
c010662a:	c7 44 24 0c ab b6 10 	movl   $0xc010b6ab,0xc(%esp)
c0106631:	c0 
c0106632:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106639:	c0 
c010663a:	c7 44 24 04 0e 01 00 	movl   $0x10e,0x4(%esp)
c0106641:	00 
c0106642:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106649:	e8 ef 9d ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c010664e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0106655:	e8 a4 07 00 00       	call   c0106dfe <alloc_pages>
c010665a:	85 c0                	test   %eax,%eax
c010665c:	74 24                	je     c0106682 <default_check+0x207>
c010665e:	c7 44 24 0c c2 b6 10 	movl   $0xc010b6c2,0xc(%esp)
c0106665:	c0 
c0106666:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c010666d:	c0 
c010666e:	c7 44 24 04 0f 01 00 	movl   $0x10f,0x4(%esp)
c0106675:	00 
c0106676:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c010667d:	e8 bb 9d ff ff       	call   c010043d <__panic>

    unsigned int nr_free_store = nr_free;
c0106682:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c0106687:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    nr_free = 0;
c010668a:	c7 05 34 e1 12 c0 00 	movl   $0x0,0xc012e134
c0106691:	00 00 00 

    free_pages(p0 + 2, 3);
c0106694:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106697:	83 c0 40             	add    $0x40,%eax
c010669a:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c01066a1:	00 
c01066a2:	89 04 24             	mov    %eax,(%esp)
c01066a5:	e8 c3 07 00 00       	call   c0106e6d <free_pages>
    assert(alloc_pages(4) == NULL);
c01066aa:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
c01066b1:	e8 48 07 00 00       	call   c0106dfe <alloc_pages>
c01066b6:	85 c0                	test   %eax,%eax
c01066b8:	74 24                	je     c01066de <default_check+0x263>
c01066ba:	c7 44 24 0c 68 b7 10 	movl   $0xc010b768,0xc(%esp)
c01066c1:	c0 
c01066c2:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01066c9:	c0 
c01066ca:	c7 44 24 04 15 01 00 	movl   $0x115,0x4(%esp)
c01066d1:	00 
c01066d2:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01066d9:	e8 5f 9d ff ff       	call   c010043d <__panic>
    assert(PageProperty(p0 + 2) && p0[2].property == 3);
c01066de:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01066e1:	83 c0 40             	add    $0x40,%eax
c01066e4:	83 c0 04             	add    $0x4,%eax
c01066e7:	c7 45 ac 01 00 00 00 	movl   $0x1,-0x54(%ebp)
c01066ee:	89 45 a8             	mov    %eax,-0x58(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c01066f1:	8b 45 a8             	mov    -0x58(%ebp),%eax
c01066f4:	8b 55 ac             	mov    -0x54(%ebp),%edx
c01066f7:	0f a3 10             	bt     %edx,(%eax)
c01066fa:	19 c0                	sbb    %eax,%eax
c01066fc:	89 45 a4             	mov    %eax,-0x5c(%ebp)
    return oldbit != 0;
c01066ff:	83 7d a4 00          	cmpl   $0x0,-0x5c(%ebp)
c0106703:	0f 95 c0             	setne  %al
c0106706:	0f b6 c0             	movzbl %al,%eax
c0106709:	85 c0                	test   %eax,%eax
c010670b:	74 0e                	je     c010671b <default_check+0x2a0>
c010670d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106710:	83 c0 40             	add    $0x40,%eax
c0106713:	8b 40 08             	mov    0x8(%eax),%eax
c0106716:	83 f8 03             	cmp    $0x3,%eax
c0106719:	74 24                	je     c010673f <default_check+0x2c4>
c010671b:	c7 44 24 0c 80 b7 10 	movl   $0xc010b780,0xc(%esp)
c0106722:	c0 
c0106723:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c010672a:	c0 
c010672b:	c7 44 24 04 16 01 00 	movl   $0x116,0x4(%esp)
c0106732:	00 
c0106733:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c010673a:	e8 fe 9c ff ff       	call   c010043d <__panic>
    assert((p1 = alloc_pages(3)) != NULL);
c010673f:	c7 04 24 03 00 00 00 	movl   $0x3,(%esp)
c0106746:	e8 b3 06 00 00       	call   c0106dfe <alloc_pages>
c010674b:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010674e:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0106752:	75 24                	jne    c0106778 <default_check+0x2fd>
c0106754:	c7 44 24 0c ac b7 10 	movl   $0xc010b7ac,0xc(%esp)
c010675b:	c0 
c010675c:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106763:	c0 
c0106764:	c7 44 24 04 17 01 00 	movl   $0x117,0x4(%esp)
c010676b:	00 
c010676c:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106773:	e8 c5 9c ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c0106778:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010677f:	e8 7a 06 00 00       	call   c0106dfe <alloc_pages>
c0106784:	85 c0                	test   %eax,%eax
c0106786:	74 24                	je     c01067ac <default_check+0x331>
c0106788:	c7 44 24 0c c2 b6 10 	movl   $0xc010b6c2,0xc(%esp)
c010678f:	c0 
c0106790:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106797:	c0 
c0106798:	c7 44 24 04 18 01 00 	movl   $0x118,0x4(%esp)
c010679f:	00 
c01067a0:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01067a7:	e8 91 9c ff ff       	call   c010043d <__panic>
    assert(p0 + 2 == p1);
c01067ac:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01067af:	83 c0 40             	add    $0x40,%eax
c01067b2:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c01067b5:	74 24                	je     c01067db <default_check+0x360>
c01067b7:	c7 44 24 0c ca b7 10 	movl   $0xc010b7ca,0xc(%esp)
c01067be:	c0 
c01067bf:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01067c6:	c0 
c01067c7:	c7 44 24 04 19 01 00 	movl   $0x119,0x4(%esp)
c01067ce:	00 
c01067cf:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01067d6:	e8 62 9c ff ff       	call   c010043d <__panic>

    p2 = p0 + 1;
c01067db:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01067de:	83 c0 20             	add    $0x20,%eax
c01067e1:	89 45 dc             	mov    %eax,-0x24(%ebp)
    free_page(p0);
c01067e4:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01067eb:	00 
c01067ec:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01067ef:	89 04 24             	mov    %eax,(%esp)
c01067f2:	e8 76 06 00 00       	call   c0106e6d <free_pages>
    free_pages(p1, 3);
c01067f7:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
c01067fe:	00 
c01067ff:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106802:	89 04 24             	mov    %eax,(%esp)
c0106805:	e8 63 06 00 00       	call   c0106e6d <free_pages>
    assert(PageProperty(p0) && p0->property == 1);
c010680a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010680d:	83 c0 04             	add    $0x4,%eax
c0106810:	c7 45 a0 01 00 00 00 	movl   $0x1,-0x60(%ebp)
c0106817:	89 45 9c             	mov    %eax,-0x64(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c010681a:	8b 45 9c             	mov    -0x64(%ebp),%eax
c010681d:	8b 55 a0             	mov    -0x60(%ebp),%edx
c0106820:	0f a3 10             	bt     %edx,(%eax)
c0106823:	19 c0                	sbb    %eax,%eax
c0106825:	89 45 98             	mov    %eax,-0x68(%ebp)
    return oldbit != 0;
c0106828:	83 7d 98 00          	cmpl   $0x0,-0x68(%ebp)
c010682c:	0f 95 c0             	setne  %al
c010682f:	0f b6 c0             	movzbl %al,%eax
c0106832:	85 c0                	test   %eax,%eax
c0106834:	74 0b                	je     c0106841 <default_check+0x3c6>
c0106836:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106839:	8b 40 08             	mov    0x8(%eax),%eax
c010683c:	83 f8 01             	cmp    $0x1,%eax
c010683f:	74 24                	je     c0106865 <default_check+0x3ea>
c0106841:	c7 44 24 0c d8 b7 10 	movl   $0xc010b7d8,0xc(%esp)
c0106848:	c0 
c0106849:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106850:	c0 
c0106851:	c7 44 24 04 1e 01 00 	movl   $0x11e,0x4(%esp)
c0106858:	00 
c0106859:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106860:	e8 d8 9b ff ff       	call   c010043d <__panic>
    assert(PageProperty(p1) && p1->property == 3);
c0106865:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106868:	83 c0 04             	add    $0x4,%eax
c010686b:	c7 45 94 01 00 00 00 	movl   $0x1,-0x6c(%ebp)
c0106872:	89 45 90             	mov    %eax,-0x70(%ebp)
    asm volatile ("btl %2, %1; sbbl %0,%0" : "=r" (oldbit) : "m" (*(volatile long *)addr), "Ir" (nr));
c0106875:	8b 45 90             	mov    -0x70(%ebp),%eax
c0106878:	8b 55 94             	mov    -0x6c(%ebp),%edx
c010687b:	0f a3 10             	bt     %edx,(%eax)
c010687e:	19 c0                	sbb    %eax,%eax
c0106880:	89 45 8c             	mov    %eax,-0x74(%ebp)
    return oldbit != 0;
c0106883:	83 7d 8c 00          	cmpl   $0x0,-0x74(%ebp)
c0106887:	0f 95 c0             	setne  %al
c010688a:	0f b6 c0             	movzbl %al,%eax
c010688d:	85 c0                	test   %eax,%eax
c010688f:	74 0b                	je     c010689c <default_check+0x421>
c0106891:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106894:	8b 40 08             	mov    0x8(%eax),%eax
c0106897:	83 f8 03             	cmp    $0x3,%eax
c010689a:	74 24                	je     c01068c0 <default_check+0x445>
c010689c:	c7 44 24 0c 00 b8 10 	movl   $0xc010b800,0xc(%esp)
c01068a3:	c0 
c01068a4:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01068ab:	c0 
c01068ac:	c7 44 24 04 1f 01 00 	movl   $0x11f,0x4(%esp)
c01068b3:	00 
c01068b4:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01068bb:	e8 7d 9b ff ff       	call   c010043d <__panic>

    assert((p0 = alloc_page()) == p2 - 1);
c01068c0:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01068c7:	e8 32 05 00 00       	call   c0106dfe <alloc_pages>
c01068cc:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01068cf:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01068d2:	83 e8 20             	sub    $0x20,%eax
c01068d5:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c01068d8:	74 24                	je     c01068fe <default_check+0x483>
c01068da:	c7 44 24 0c 26 b8 10 	movl   $0xc010b826,0xc(%esp)
c01068e1:	c0 
c01068e2:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01068e9:	c0 
c01068ea:	c7 44 24 04 21 01 00 	movl   $0x121,0x4(%esp)
c01068f1:	00 
c01068f2:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01068f9:	e8 3f 9b ff ff       	call   c010043d <__panic>
    free_page(p0);
c01068fe:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106905:	00 
c0106906:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106909:	89 04 24             	mov    %eax,(%esp)
c010690c:	e8 5c 05 00 00       	call   c0106e6d <free_pages>
    assert((p0 = alloc_pages(2)) == p2 + 1);
c0106911:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c0106918:	e8 e1 04 00 00       	call   c0106dfe <alloc_pages>
c010691d:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0106920:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0106923:	83 c0 20             	add    $0x20,%eax
c0106926:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c0106929:	74 24                	je     c010694f <default_check+0x4d4>
c010692b:	c7 44 24 0c 44 b8 10 	movl   $0xc010b844,0xc(%esp)
c0106932:	c0 
c0106933:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c010693a:	c0 
c010693b:	c7 44 24 04 23 01 00 	movl   $0x123,0x4(%esp)
c0106942:	00 
c0106943:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c010694a:	e8 ee 9a ff ff       	call   c010043d <__panic>

    free_pages(p0, 2);
c010694f:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c0106956:	00 
c0106957:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010695a:	89 04 24             	mov    %eax,(%esp)
c010695d:	e8 0b 05 00 00       	call   c0106e6d <free_pages>
    free_page(p2);
c0106962:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0106969:	00 
c010696a:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010696d:	89 04 24             	mov    %eax,(%esp)
c0106970:	e8 f8 04 00 00       	call   c0106e6d <free_pages>

    assert((p0 = alloc_pages(5)) != NULL);
c0106975:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
c010697c:	e8 7d 04 00 00       	call   c0106dfe <alloc_pages>
c0106981:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0106984:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0106988:	75 24                	jne    c01069ae <default_check+0x533>
c010698a:	c7 44 24 0c 64 b8 10 	movl   $0xc010b864,0xc(%esp)
c0106991:	c0 
c0106992:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106999:	c0 
c010699a:	c7 44 24 04 28 01 00 	movl   $0x128,0x4(%esp)
c01069a1:	00 
c01069a2:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01069a9:	e8 8f 9a ff ff       	call   c010043d <__panic>
    assert(alloc_page() == NULL);
c01069ae:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01069b5:	e8 44 04 00 00       	call   c0106dfe <alloc_pages>
c01069ba:	85 c0                	test   %eax,%eax
c01069bc:	74 24                	je     c01069e2 <default_check+0x567>
c01069be:	c7 44 24 0c c2 b6 10 	movl   $0xc010b6c2,0xc(%esp)
c01069c5:	c0 
c01069c6:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01069cd:	c0 
c01069ce:	c7 44 24 04 29 01 00 	movl   $0x129,0x4(%esp)
c01069d5:	00 
c01069d6:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c01069dd:	e8 5b 9a ff ff       	call   c010043d <__panic>

    assert(nr_free == 0);
c01069e2:	a1 34 e1 12 c0       	mov    0xc012e134,%eax
c01069e7:	85 c0                	test   %eax,%eax
c01069e9:	74 24                	je     c0106a0f <default_check+0x594>
c01069eb:	c7 44 24 0c 15 b7 10 	movl   $0xc010b715,0xc(%esp)
c01069f2:	c0 
c01069f3:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c01069fa:	c0 
c01069fb:	c7 44 24 04 2b 01 00 	movl   $0x12b,0x4(%esp)
c0106a02:	00 
c0106a03:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106a0a:	e8 2e 9a ff ff       	call   c010043d <__panic>
    nr_free = nr_free_store;
c0106a0f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0106a12:	a3 34 e1 12 c0       	mov    %eax,0xc012e134

    free_list = free_list_store;
c0106a17:	8b 45 80             	mov    -0x80(%ebp),%eax
c0106a1a:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0106a1d:	a3 2c e1 12 c0       	mov    %eax,0xc012e12c
c0106a22:	89 15 30 e1 12 c0    	mov    %edx,0xc012e130
    free_pages(p0, 5);
c0106a28:	c7 44 24 04 05 00 00 	movl   $0x5,0x4(%esp)
c0106a2f:	00 
c0106a30:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0106a33:	89 04 24             	mov    %eax,(%esp)
c0106a36:	e8 32 04 00 00       	call   c0106e6d <free_pages>

    le = &free_list;
c0106a3b:	c7 45 ec 2c e1 12 c0 	movl   $0xc012e12c,-0x14(%ebp)
    while ((le = list_next(le)) != &free_list) {
c0106a42:	eb 1c                	jmp    c0106a60 <default_check+0x5e5>
        struct Page *p = le2page(le, page_link);
c0106a44:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a47:	83 e8 0c             	sub    $0xc,%eax
c0106a4a:	89 45 d8             	mov    %eax,-0x28(%ebp)
        count --, total -= p->property;
c0106a4d:	ff 4d f4             	decl   -0xc(%ebp)
c0106a50:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0106a53:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0106a56:	8b 40 08             	mov    0x8(%eax),%eax
c0106a59:	29 c2                	sub    %eax,%edx
c0106a5b:	89 d0                	mov    %edx,%eax
c0106a5d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106a60:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0106a63:	89 45 88             	mov    %eax,-0x78(%ebp)
    return listelm->next;
c0106a66:	8b 45 88             	mov    -0x78(%ebp),%eax
c0106a69:	8b 40 04             	mov    0x4(%eax),%eax
    while ((le = list_next(le)) != &free_list) {
c0106a6c:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0106a6f:	81 7d ec 2c e1 12 c0 	cmpl   $0xc012e12c,-0x14(%ebp)
c0106a76:	75 cc                	jne    c0106a44 <default_check+0x5c9>
    }
    assert(count == 0);
c0106a78:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106a7c:	74 24                	je     c0106aa2 <default_check+0x627>
c0106a7e:	c7 44 24 0c 82 b8 10 	movl   $0xc010b882,0xc(%esp)
c0106a85:	c0 
c0106a86:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106a8d:	c0 
c0106a8e:	c7 44 24 04 36 01 00 	movl   $0x136,0x4(%esp)
c0106a95:	00 
c0106a96:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106a9d:	e8 9b 99 ff ff       	call   c010043d <__panic>
    assert(total == 0);
c0106aa2:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0106aa6:	74 24                	je     c0106acc <default_check+0x651>
c0106aa8:	c7 44 24 0c 8d b8 10 	movl   $0xc010b88d,0xc(%esp)
c0106aaf:	c0 
c0106ab0:	c7 44 24 08 22 b5 10 	movl   $0xc010b522,0x8(%esp)
c0106ab7:	c0 
c0106ab8:	c7 44 24 04 37 01 00 	movl   $0x137,0x4(%esp)
c0106abf:	00 
c0106ac0:	c7 04 24 37 b5 10 c0 	movl   $0xc010b537,(%esp)
c0106ac7:	e8 71 99 ff ff       	call   c010043d <__panic>
}
c0106acc:	90                   	nop
c0106acd:	c9                   	leave  
c0106ace:	c3                   	ret    

c0106acf <page2ppn>:
page2ppn(struct Page *page) {
c0106acf:	55                   	push   %ebp
c0106ad0:	89 e5                	mov    %esp,%ebp
    return page - pages;
c0106ad2:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c0106ad7:	8b 55 08             	mov    0x8(%ebp),%edx
c0106ada:	29 c2                	sub    %eax,%edx
c0106adc:	89 d0                	mov    %edx,%eax
c0106ade:	c1 f8 05             	sar    $0x5,%eax
}
c0106ae1:	5d                   	pop    %ebp
c0106ae2:	c3                   	ret    

c0106ae3 <page2pa>:
page2pa(struct Page *page) {
c0106ae3:	55                   	push   %ebp
c0106ae4:	89 e5                	mov    %esp,%ebp
c0106ae6:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c0106ae9:	8b 45 08             	mov    0x8(%ebp),%eax
c0106aec:	89 04 24             	mov    %eax,(%esp)
c0106aef:	e8 db ff ff ff       	call   c0106acf <page2ppn>
c0106af4:	c1 e0 0c             	shl    $0xc,%eax
}
c0106af7:	c9                   	leave  
c0106af8:	c3                   	ret    

c0106af9 <pa2page>:
pa2page(uintptr_t pa) {
c0106af9:	55                   	push   %ebp
c0106afa:	89 e5                	mov    %esp,%ebp
c0106afc:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0106aff:	8b 45 08             	mov    0x8(%ebp),%eax
c0106b02:	c1 e8 0c             	shr    $0xc,%eax
c0106b05:	89 c2                	mov    %eax,%edx
c0106b07:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0106b0c:	39 c2                	cmp    %eax,%edx
c0106b0e:	72 1c                	jb     c0106b2c <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0106b10:	c7 44 24 08 c8 b8 10 	movl   $0xc010b8c8,0x8(%esp)
c0106b17:	c0 
c0106b18:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0106b1f:	00 
c0106b20:	c7 04 24 e7 b8 10 c0 	movl   $0xc010b8e7,(%esp)
c0106b27:	e8 11 99 ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0106b2c:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c0106b31:	8b 55 08             	mov    0x8(%ebp),%edx
c0106b34:	c1 ea 0c             	shr    $0xc,%edx
c0106b37:	c1 e2 05             	shl    $0x5,%edx
c0106b3a:	01 d0                	add    %edx,%eax
}
c0106b3c:	c9                   	leave  
c0106b3d:	c3                   	ret    

c0106b3e <page2kva>:
page2kva(struct Page *page) {
c0106b3e:	55                   	push   %ebp
c0106b3f:	89 e5                	mov    %esp,%ebp
c0106b41:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c0106b44:	8b 45 08             	mov    0x8(%ebp),%eax
c0106b47:	89 04 24             	mov    %eax,(%esp)
c0106b4a:	e8 94 ff ff ff       	call   c0106ae3 <page2pa>
c0106b4f:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0106b52:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106b55:	c1 e8 0c             	shr    $0xc,%eax
c0106b58:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0106b5b:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0106b60:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0106b63:	72 23                	jb     c0106b88 <page2kva+0x4a>
c0106b65:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106b68:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106b6c:	c7 44 24 08 f8 b8 10 	movl   $0xc010b8f8,0x8(%esp)
c0106b73:	c0 
c0106b74:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0106b7b:	00 
c0106b7c:	c7 04 24 e7 b8 10 c0 	movl   $0xc010b8e7,(%esp)
c0106b83:	e8 b5 98 ff ff       	call   c010043d <__panic>
c0106b88:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106b8b:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c0106b90:	c9                   	leave  
c0106b91:	c3                   	ret    

c0106b92 <pte2page>:
pte2page(pte_t pte) {
c0106b92:	55                   	push   %ebp
c0106b93:	89 e5                	mov    %esp,%ebp
c0106b95:	83 ec 18             	sub    $0x18,%esp
    if (!(pte & PTE_P)) {
c0106b98:	8b 45 08             	mov    0x8(%ebp),%eax
c0106b9b:	83 e0 01             	and    $0x1,%eax
c0106b9e:	85 c0                	test   %eax,%eax
c0106ba0:	75 1c                	jne    c0106bbe <pte2page+0x2c>
        panic("pte2page called with invalid pte");
c0106ba2:	c7 44 24 08 1c b9 10 	movl   $0xc010b91c,0x8(%esp)
c0106ba9:	c0 
c0106baa:	c7 44 24 04 71 00 00 	movl   $0x71,0x4(%esp)
c0106bb1:	00 
c0106bb2:	c7 04 24 e7 b8 10 c0 	movl   $0xc010b8e7,(%esp)
c0106bb9:	e8 7f 98 ff ff       	call   c010043d <__panic>
    return pa2page(PTE_ADDR(pte));
c0106bbe:	8b 45 08             	mov    0x8(%ebp),%eax
c0106bc1:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0106bc6:	89 04 24             	mov    %eax,(%esp)
c0106bc9:	e8 2b ff ff ff       	call   c0106af9 <pa2page>
}
c0106bce:	c9                   	leave  
c0106bcf:	c3                   	ret    

c0106bd0 <pde2page>:
pde2page(pde_t pde) {
c0106bd0:	55                   	push   %ebp
c0106bd1:	89 e5                	mov    %esp,%ebp
c0106bd3:	83 ec 18             	sub    $0x18,%esp
    return pa2page(PDE_ADDR(pde));
c0106bd6:	8b 45 08             	mov    0x8(%ebp),%eax
c0106bd9:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0106bde:	89 04 24             	mov    %eax,(%esp)
c0106be1:	e8 13 ff ff ff       	call   c0106af9 <pa2page>
}
c0106be6:	c9                   	leave  
c0106be7:	c3                   	ret    

c0106be8 <page_ref>:
page_ref(struct Page *page) {
c0106be8:	55                   	push   %ebp
c0106be9:	89 e5                	mov    %esp,%ebp
    return page->ref;
c0106beb:	8b 45 08             	mov    0x8(%ebp),%eax
c0106bee:	8b 00                	mov    (%eax),%eax
}
c0106bf0:	5d                   	pop    %ebp
c0106bf1:	c3                   	ret    

c0106bf2 <set_page_ref>:
set_page_ref(struct Page *page, int val) {
c0106bf2:	55                   	push   %ebp
c0106bf3:	89 e5                	mov    %esp,%ebp
    page->ref = val;
c0106bf5:	8b 45 08             	mov    0x8(%ebp),%eax
c0106bf8:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106bfb:	89 10                	mov    %edx,(%eax)
}
c0106bfd:	90                   	nop
c0106bfe:	5d                   	pop    %ebp
c0106bff:	c3                   	ret    

c0106c00 <page_ref_inc>:

static inline int
page_ref_inc(struct Page *page) {
c0106c00:	55                   	push   %ebp
c0106c01:	89 e5                	mov    %esp,%ebp
    page->ref += 1;
c0106c03:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c06:	8b 00                	mov    (%eax),%eax
c0106c08:	8d 50 01             	lea    0x1(%eax),%edx
c0106c0b:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c0e:	89 10                	mov    %edx,(%eax)
    return page->ref;
c0106c10:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c13:	8b 00                	mov    (%eax),%eax
}
c0106c15:	5d                   	pop    %ebp
c0106c16:	c3                   	ret    

c0106c17 <page_ref_dec>:

static inline int
page_ref_dec(struct Page *page) {
c0106c17:	55                   	push   %ebp
c0106c18:	89 e5                	mov    %esp,%ebp
    page->ref -= 1;
c0106c1a:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c1d:	8b 00                	mov    (%eax),%eax
c0106c1f:	8d 50 ff             	lea    -0x1(%eax),%edx
c0106c22:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c25:	89 10                	mov    %edx,(%eax)
    return page->ref;
c0106c27:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c2a:	8b 00                	mov    (%eax),%eax
}
c0106c2c:	5d                   	pop    %ebp
c0106c2d:	c3                   	ret    

c0106c2e <__intr_save>:
__intr_save(void) {
c0106c2e:	55                   	push   %ebp
c0106c2f:	89 e5                	mov    %esp,%ebp
c0106c31:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c0106c34:	9c                   	pushf  
c0106c35:	58                   	pop    %eax
c0106c36:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c0106c39:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c0106c3c:	25 00 02 00 00       	and    $0x200,%eax
c0106c41:	85 c0                	test   %eax,%eax
c0106c43:	74 0c                	je     c0106c51 <__intr_save+0x23>
        intr_disable();
c0106c45:	e8 04 b5 ff ff       	call   c010214e <intr_disable>
        return 1;
c0106c4a:	b8 01 00 00 00       	mov    $0x1,%eax
c0106c4f:	eb 05                	jmp    c0106c56 <__intr_save+0x28>
    return 0;
c0106c51:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0106c56:	c9                   	leave  
c0106c57:	c3                   	ret    

c0106c58 <__intr_restore>:
__intr_restore(bool flag) {
c0106c58:	55                   	push   %ebp
c0106c59:	89 e5                	mov    %esp,%ebp
c0106c5b:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c0106c5e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0106c62:	74 05                	je     c0106c69 <__intr_restore+0x11>
        intr_enable();
c0106c64:	e8 d9 b4 ff ff       	call   c0102142 <intr_enable>
}
c0106c69:	90                   	nop
c0106c6a:	c9                   	leave  
c0106c6b:	c3                   	ret    

c0106c6c <lgdt>:
/* *
 * lgdt - load the global descriptor table register and reset the
 * data/code segement registers for kernel.
 * */
static inline void
lgdt(struct pseudodesc *pd) {
c0106c6c:	55                   	push   %ebp
c0106c6d:	89 e5                	mov    %esp,%ebp
    asm volatile ("lgdt (%0)" :: "r" (pd));
c0106c6f:	8b 45 08             	mov    0x8(%ebp),%eax
c0106c72:	0f 01 10             	lgdtl  (%eax)
    asm volatile ("movw %%ax, %%gs" :: "a" (USER_DS));
c0106c75:	b8 23 00 00 00       	mov    $0x23,%eax
c0106c7a:	8e e8                	mov    %eax,%gs
    asm volatile ("movw %%ax, %%fs" :: "a" (USER_DS));
c0106c7c:	b8 23 00 00 00       	mov    $0x23,%eax
c0106c81:	8e e0                	mov    %eax,%fs
    asm volatile ("movw %%ax, %%es" :: "a" (KERNEL_DS));
c0106c83:	b8 10 00 00 00       	mov    $0x10,%eax
c0106c88:	8e c0                	mov    %eax,%es
    asm volatile ("movw %%ax, %%ds" :: "a" (KERNEL_DS));
c0106c8a:	b8 10 00 00 00       	mov    $0x10,%eax
c0106c8f:	8e d8                	mov    %eax,%ds
    asm volatile ("movw %%ax, %%ss" :: "a" (KERNEL_DS));
c0106c91:	b8 10 00 00 00       	mov    $0x10,%eax
c0106c96:	8e d0                	mov    %eax,%ss
    // reload cs
    asm volatile ("ljmp %0, $1f\n 1:\n" :: "i" (KERNEL_CS));
c0106c98:	ea 9f 6c 10 c0 08 00 	ljmp   $0x8,$0xc0106c9f
}
c0106c9f:	90                   	nop
c0106ca0:	5d                   	pop    %ebp
c0106ca1:	c3                   	ret    

c0106ca2 <load_esp0>:
 * load_esp0 - change the ESP0 in default task state segment,
 * so that we can use different kernel stack when we trap frame
 * user to kernel.
 * */
void
load_esp0(uintptr_t esp0) {
c0106ca2:	f3 0f 1e fb          	endbr32 
c0106ca6:	55                   	push   %ebp
c0106ca7:	89 e5                	mov    %esp,%ebp
    ts.ts_esp0 = esp0;
c0106ca9:	8b 45 08             	mov    0x8(%ebp),%eax
c0106cac:	a3 a4 bf 12 c0       	mov    %eax,0xc012bfa4
}
c0106cb1:	90                   	nop
c0106cb2:	5d                   	pop    %ebp
c0106cb3:	c3                   	ret    

c0106cb4 <gdt_init>:

/* gdt_init - initialize the default GDT and TSS */
static void
gdt_init(void) {
c0106cb4:	f3 0f 1e fb          	endbr32 
c0106cb8:	55                   	push   %ebp
c0106cb9:	89 e5                	mov    %esp,%ebp
c0106cbb:	83 ec 14             	sub    $0x14,%esp
    // set boot kernel stack and default SS0
    load_esp0((uintptr_t)bootstacktop);
c0106cbe:	b8 00 80 12 c0       	mov    $0xc0128000,%eax
c0106cc3:	89 04 24             	mov    %eax,(%esp)
c0106cc6:	e8 d7 ff ff ff       	call   c0106ca2 <load_esp0>
    ts.ts_ss0 = KERNEL_DS;
c0106ccb:	66 c7 05 a8 bf 12 c0 	movw   $0x10,0xc012bfa8
c0106cd2:	10 00 

    // initialize the TSS filed of the gdt
    gdt[SEG_TSS] = SEGTSS(STS_T32A, (uintptr_t)&ts, sizeof(ts), DPL_KERNEL);
c0106cd4:	66 c7 05 68 8a 12 c0 	movw   $0x68,0xc0128a68
c0106cdb:	68 00 
c0106cdd:	b8 a0 bf 12 c0       	mov    $0xc012bfa0,%eax
c0106ce2:	0f b7 c0             	movzwl %ax,%eax
c0106ce5:	66 a3 6a 8a 12 c0    	mov    %ax,0xc0128a6a
c0106ceb:	b8 a0 bf 12 c0       	mov    $0xc012bfa0,%eax
c0106cf0:	c1 e8 10             	shr    $0x10,%eax
c0106cf3:	a2 6c 8a 12 c0       	mov    %al,0xc0128a6c
c0106cf8:	0f b6 05 6d 8a 12 c0 	movzbl 0xc0128a6d,%eax
c0106cff:	24 f0                	and    $0xf0,%al
c0106d01:	0c 09                	or     $0x9,%al
c0106d03:	a2 6d 8a 12 c0       	mov    %al,0xc0128a6d
c0106d08:	0f b6 05 6d 8a 12 c0 	movzbl 0xc0128a6d,%eax
c0106d0f:	24 ef                	and    $0xef,%al
c0106d11:	a2 6d 8a 12 c0       	mov    %al,0xc0128a6d
c0106d16:	0f b6 05 6d 8a 12 c0 	movzbl 0xc0128a6d,%eax
c0106d1d:	24 9f                	and    $0x9f,%al
c0106d1f:	a2 6d 8a 12 c0       	mov    %al,0xc0128a6d
c0106d24:	0f b6 05 6d 8a 12 c0 	movzbl 0xc0128a6d,%eax
c0106d2b:	0c 80                	or     $0x80,%al
c0106d2d:	a2 6d 8a 12 c0       	mov    %al,0xc0128a6d
c0106d32:	0f b6 05 6e 8a 12 c0 	movzbl 0xc0128a6e,%eax
c0106d39:	24 f0                	and    $0xf0,%al
c0106d3b:	a2 6e 8a 12 c0       	mov    %al,0xc0128a6e
c0106d40:	0f b6 05 6e 8a 12 c0 	movzbl 0xc0128a6e,%eax
c0106d47:	24 ef                	and    $0xef,%al
c0106d49:	a2 6e 8a 12 c0       	mov    %al,0xc0128a6e
c0106d4e:	0f b6 05 6e 8a 12 c0 	movzbl 0xc0128a6e,%eax
c0106d55:	24 df                	and    $0xdf,%al
c0106d57:	a2 6e 8a 12 c0       	mov    %al,0xc0128a6e
c0106d5c:	0f b6 05 6e 8a 12 c0 	movzbl 0xc0128a6e,%eax
c0106d63:	0c 40                	or     $0x40,%al
c0106d65:	a2 6e 8a 12 c0       	mov    %al,0xc0128a6e
c0106d6a:	0f b6 05 6e 8a 12 c0 	movzbl 0xc0128a6e,%eax
c0106d71:	24 7f                	and    $0x7f,%al
c0106d73:	a2 6e 8a 12 c0       	mov    %al,0xc0128a6e
c0106d78:	b8 a0 bf 12 c0       	mov    $0xc012bfa0,%eax
c0106d7d:	c1 e8 18             	shr    $0x18,%eax
c0106d80:	a2 6f 8a 12 c0       	mov    %al,0xc0128a6f

    // reload all segment registers
    lgdt(&gdt_pd);
c0106d85:	c7 04 24 70 8a 12 c0 	movl   $0xc0128a70,(%esp)
c0106d8c:	e8 db fe ff ff       	call   c0106c6c <lgdt>
c0106d91:	66 c7 45 fe 28 00    	movw   $0x28,-0x2(%ebp)
    asm volatile ("ltr %0" :: "r" (sel) : "memory");
c0106d97:	0f b7 45 fe          	movzwl -0x2(%ebp),%eax
c0106d9b:	0f 00 d8             	ltr    %ax
}
c0106d9e:	90                   	nop

    // load the TSS
    ltr(GD_TSS);
}
c0106d9f:	90                   	nop
c0106da0:	c9                   	leave  
c0106da1:	c3                   	ret    

c0106da2 <init_pmm_manager>:

//init_pmm_manager - initialize a pmm_manager instance
static void
init_pmm_manager(void) {
c0106da2:	f3 0f 1e fb          	endbr32 
c0106da6:	55                   	push   %ebp
c0106da7:	89 e5                	mov    %esp,%ebp
c0106da9:	83 ec 18             	sub    $0x18,%esp
    pmm_manager = &default_pmm_manager;
c0106dac:	c7 05 38 e1 12 c0 ac 	movl   $0xc010b8ac,0xc012e138
c0106db3:	b8 10 c0 
    cprintf("memory management: %s\n", pmm_manager->name);
c0106db6:	a1 38 e1 12 c0       	mov    0xc012e138,%eax
c0106dbb:	8b 00                	mov    (%eax),%eax
c0106dbd:	89 44 24 04          	mov    %eax,0x4(%esp)
c0106dc1:	c7 04 24 48 b9 10 c0 	movl   $0xc010b948,(%esp)
c0106dc8:	e8 04 95 ff ff       	call   c01002d1 <cprintf>
    pmm_manager->init();
c0106dcd:	a1 38 e1 12 c0       	mov    0xc012e138,%eax
c0106dd2:	8b 40 04             	mov    0x4(%eax),%eax
c0106dd5:	ff d0                	call   *%eax
}
c0106dd7:	90                   	nop
c0106dd8:	c9                   	leave  
c0106dd9:	c3                   	ret    

c0106dda <init_memmap>:

//init_memmap - call pmm->init_memmap to build Page struct for free memory  
static void
init_memmap(struct Page *base, size_t n) {
c0106dda:	f3 0f 1e fb          	endbr32 
c0106dde:	55                   	push   %ebp
c0106ddf:	89 e5                	mov    %esp,%ebp
c0106de1:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->init_memmap(base, n);
c0106de4:	a1 38 e1 12 c0       	mov    0xc012e138,%eax
c0106de9:	8b 40 08             	mov    0x8(%eax),%eax
c0106dec:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106def:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106df3:	8b 55 08             	mov    0x8(%ebp),%edx
c0106df6:	89 14 24             	mov    %edx,(%esp)
c0106df9:	ff d0                	call   *%eax
}
c0106dfb:	90                   	nop
c0106dfc:	c9                   	leave  
c0106dfd:	c3                   	ret    

c0106dfe <alloc_pages>:

//alloc_pages - call pmm->alloc_pages to allocate a continuous n*PAGESIZE memory 
struct Page *
alloc_pages(size_t n) {
c0106dfe:	f3 0f 1e fb          	endbr32 
c0106e02:	55                   	push   %ebp
c0106e03:	89 e5                	mov    %esp,%ebp
c0106e05:	83 ec 28             	sub    $0x28,%esp
    struct Page *page=NULL;
c0106e08:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    bool intr_flag;
    
    while (1)
    {
         local_intr_save(intr_flag);
c0106e0f:	e8 1a fe ff ff       	call   c0106c2e <__intr_save>
c0106e14:	89 45 f0             	mov    %eax,-0x10(%ebp)
         {
              page = pmm_manager->alloc_pages(n);
c0106e17:	a1 38 e1 12 c0       	mov    0xc012e138,%eax
c0106e1c:	8b 40 0c             	mov    0xc(%eax),%eax
c0106e1f:	8b 55 08             	mov    0x8(%ebp),%edx
c0106e22:	89 14 24             	mov    %edx,(%esp)
c0106e25:	ff d0                	call   *%eax
c0106e27:	89 45 f4             	mov    %eax,-0xc(%ebp)
         }
         local_intr_restore(intr_flag);
c0106e2a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0106e2d:	89 04 24             	mov    %eax,(%esp)
c0106e30:	e8 23 fe ff ff       	call   c0106c58 <__intr_restore>

         if (page != NULL || n > 1 || swap_init_ok == 0) break;
c0106e35:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0106e39:	75 2d                	jne    c0106e68 <alloc_pages+0x6a>
c0106e3b:	83 7d 08 01          	cmpl   $0x1,0x8(%ebp)
c0106e3f:	77 27                	ja     c0106e68 <alloc_pages+0x6a>
c0106e41:	a1 68 bf 12 c0       	mov    0xc012bf68,%eax
c0106e46:	85 c0                	test   %eax,%eax
c0106e48:	74 1e                	je     c0106e68 <alloc_pages+0x6a>
         
         extern struct mm_struct *check_mm_struct;
         //cprintf("page %x, call swap_out in alloc_pages %d\n",page, n);
         swap_out(check_mm_struct, n, 0);
c0106e4a:	8b 55 08             	mov    0x8(%ebp),%edx
c0106e4d:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c0106e52:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0106e59:	00 
c0106e5a:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106e5e:	89 04 24             	mov    %eax,(%esp)
c0106e61:	e8 f4 d2 ff ff       	call   c010415a <swap_out>
    {
c0106e66:	eb a7                	jmp    c0106e0f <alloc_pages+0x11>
    }
    //cprintf("n %d,get page %x, No %d in alloc_pages\n",n,page,(page-pages));
    return page;
c0106e68:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0106e6b:	c9                   	leave  
c0106e6c:	c3                   	ret    

c0106e6d <free_pages>:

//free_pages - call pmm->free_pages to free a continuous n*PAGESIZE memory 
void
free_pages(struct Page *base, size_t n) {
c0106e6d:	f3 0f 1e fb          	endbr32 
c0106e71:	55                   	push   %ebp
c0106e72:	89 e5                	mov    %esp,%ebp
c0106e74:	83 ec 28             	sub    $0x28,%esp
    bool intr_flag;
    local_intr_save(intr_flag);
c0106e77:	e8 b2 fd ff ff       	call   c0106c2e <__intr_save>
c0106e7c:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        pmm_manager->free_pages(base, n);
c0106e7f:	a1 38 e1 12 c0       	mov    0xc012e138,%eax
c0106e84:	8b 40 10             	mov    0x10(%eax),%eax
c0106e87:	8b 55 0c             	mov    0xc(%ebp),%edx
c0106e8a:	89 54 24 04          	mov    %edx,0x4(%esp)
c0106e8e:	8b 55 08             	mov    0x8(%ebp),%edx
c0106e91:	89 14 24             	mov    %edx,(%esp)
c0106e94:	ff d0                	call   *%eax
    }
    local_intr_restore(intr_flag);
c0106e96:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106e99:	89 04 24             	mov    %eax,(%esp)
c0106e9c:	e8 b7 fd ff ff       	call   c0106c58 <__intr_restore>
}
c0106ea1:	90                   	nop
c0106ea2:	c9                   	leave  
c0106ea3:	c3                   	ret    

c0106ea4 <nr_free_pages>:

//nr_free_pages - call pmm->nr_free_pages to get the size (nr*PAGESIZE) 
//of current free memory
size_t
nr_free_pages(void) {
c0106ea4:	f3 0f 1e fb          	endbr32 
c0106ea8:	55                   	push   %ebp
c0106ea9:	89 e5                	mov    %esp,%ebp
c0106eab:	83 ec 28             	sub    $0x28,%esp
    size_t ret;
    bool intr_flag;
    local_intr_save(intr_flag);
c0106eae:	e8 7b fd ff ff       	call   c0106c2e <__intr_save>
c0106eb3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    {
        ret = pmm_manager->nr_free_pages();
c0106eb6:	a1 38 e1 12 c0       	mov    0xc012e138,%eax
c0106ebb:	8b 40 14             	mov    0x14(%eax),%eax
c0106ebe:	ff d0                	call   *%eax
c0106ec0:	89 45 f0             	mov    %eax,-0x10(%ebp)
    }
    local_intr_restore(intr_flag);
c0106ec3:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0106ec6:	89 04 24             	mov    %eax,(%esp)
c0106ec9:	e8 8a fd ff ff       	call   c0106c58 <__intr_restore>
    return ret;
c0106ece:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
c0106ed1:	c9                   	leave  
c0106ed2:	c3                   	ret    

c0106ed3 <page_init>:

/* pmm_init - initialize the physical memory management */
static void
page_init(void) {
c0106ed3:	f3 0f 1e fb          	endbr32 
c0106ed7:	55                   	push   %ebp
c0106ed8:	89 e5                	mov    %esp,%ebp
c0106eda:	57                   	push   %edi
c0106edb:	56                   	push   %esi
c0106edc:	53                   	push   %ebx
c0106edd:	81 ec 9c 00 00 00    	sub    $0x9c,%esp
    struct e820map *memmap = (struct e820map *)(0x8000 + KERNBASE);
c0106ee3:	c7 45 c4 00 80 00 c0 	movl   $0xc0008000,-0x3c(%ebp)
    uint64_t maxpa = 0;
c0106eea:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
c0106ef1:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)

    cprintf("e820map:\n");
c0106ef8:	c7 04 24 5f b9 10 c0 	movl   $0xc010b95f,(%esp)
c0106eff:	e8 cd 93 ff ff       	call   c01002d1 <cprintf>
    int i;
    for (i = 0; i < memmap->nr_map; i ++) {
c0106f04:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0106f0b:	e9 1a 01 00 00       	jmp    c010702a <page_init+0x157>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0106f10:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0106f13:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0106f16:	89 d0                	mov    %edx,%eax
c0106f18:	c1 e0 02             	shl    $0x2,%eax
c0106f1b:	01 d0                	add    %edx,%eax
c0106f1d:	c1 e0 02             	shl    $0x2,%eax
c0106f20:	01 c8                	add    %ecx,%eax
c0106f22:	8b 50 08             	mov    0x8(%eax),%edx
c0106f25:	8b 40 04             	mov    0x4(%eax),%eax
c0106f28:	89 45 a0             	mov    %eax,-0x60(%ebp)
c0106f2b:	89 55 a4             	mov    %edx,-0x5c(%ebp)
c0106f2e:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0106f31:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0106f34:	89 d0                	mov    %edx,%eax
c0106f36:	c1 e0 02             	shl    $0x2,%eax
c0106f39:	01 d0                	add    %edx,%eax
c0106f3b:	c1 e0 02             	shl    $0x2,%eax
c0106f3e:	01 c8                	add    %ecx,%eax
c0106f40:	8b 48 0c             	mov    0xc(%eax),%ecx
c0106f43:	8b 58 10             	mov    0x10(%eax),%ebx
c0106f46:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0106f49:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0106f4c:	01 c8                	add    %ecx,%eax
c0106f4e:	11 da                	adc    %ebx,%edx
c0106f50:	89 45 98             	mov    %eax,-0x68(%ebp)
c0106f53:	89 55 9c             	mov    %edx,-0x64(%ebp)
        cprintf("  memory: %08llx, [%08llx, %08llx], type = %d.\n",
c0106f56:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0106f59:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0106f5c:	89 d0                	mov    %edx,%eax
c0106f5e:	c1 e0 02             	shl    $0x2,%eax
c0106f61:	01 d0                	add    %edx,%eax
c0106f63:	c1 e0 02             	shl    $0x2,%eax
c0106f66:	01 c8                	add    %ecx,%eax
c0106f68:	83 c0 14             	add    $0x14,%eax
c0106f6b:	8b 00                	mov    (%eax),%eax
c0106f6d:	89 45 84             	mov    %eax,-0x7c(%ebp)
c0106f70:	8b 45 98             	mov    -0x68(%ebp),%eax
c0106f73:	8b 55 9c             	mov    -0x64(%ebp),%edx
c0106f76:	83 c0 ff             	add    $0xffffffff,%eax
c0106f79:	83 d2 ff             	adc    $0xffffffff,%edx
c0106f7c:	89 85 78 ff ff ff    	mov    %eax,-0x88(%ebp)
c0106f82:	89 95 7c ff ff ff    	mov    %edx,-0x84(%ebp)
c0106f88:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0106f8b:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0106f8e:	89 d0                	mov    %edx,%eax
c0106f90:	c1 e0 02             	shl    $0x2,%eax
c0106f93:	01 d0                	add    %edx,%eax
c0106f95:	c1 e0 02             	shl    $0x2,%eax
c0106f98:	01 c8                	add    %ecx,%eax
c0106f9a:	8b 48 0c             	mov    0xc(%eax),%ecx
c0106f9d:	8b 58 10             	mov    0x10(%eax),%ebx
c0106fa0:	8b 55 84             	mov    -0x7c(%ebp),%edx
c0106fa3:	89 54 24 1c          	mov    %edx,0x1c(%esp)
c0106fa7:	8b 85 78 ff ff ff    	mov    -0x88(%ebp),%eax
c0106fad:	8b 95 7c ff ff ff    	mov    -0x84(%ebp),%edx
c0106fb3:	89 44 24 14          	mov    %eax,0x14(%esp)
c0106fb7:	89 54 24 18          	mov    %edx,0x18(%esp)
c0106fbb:	8b 45 a0             	mov    -0x60(%ebp),%eax
c0106fbe:	8b 55 a4             	mov    -0x5c(%ebp),%edx
c0106fc1:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0106fc5:	89 54 24 10          	mov    %edx,0x10(%esp)
c0106fc9:	89 4c 24 04          	mov    %ecx,0x4(%esp)
c0106fcd:	89 5c 24 08          	mov    %ebx,0x8(%esp)
c0106fd1:	c7 04 24 6c b9 10 c0 	movl   $0xc010b96c,(%esp)
c0106fd8:	e8 f4 92 ff ff       	call   c01002d1 <cprintf>
                memmap->map[i].size, begin, end - 1, memmap->map[i].type);
        if (memmap->map[i].type == E820_ARM) {
c0106fdd:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0106fe0:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0106fe3:	89 d0                	mov    %edx,%eax
c0106fe5:	c1 e0 02             	shl    $0x2,%eax
c0106fe8:	01 d0                	add    %edx,%eax
c0106fea:	c1 e0 02             	shl    $0x2,%eax
c0106fed:	01 c8                	add    %ecx,%eax
c0106fef:	83 c0 14             	add    $0x14,%eax
c0106ff2:	8b 00                	mov    (%eax),%eax
c0106ff4:	83 f8 01             	cmp    $0x1,%eax
c0106ff7:	75 2e                	jne    c0107027 <page_init+0x154>
            if (maxpa < end && begin < KMEMSIZE) {
c0106ff9:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0106ffc:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0106fff:	3b 45 98             	cmp    -0x68(%ebp),%eax
c0107002:	89 d0                	mov    %edx,%eax
c0107004:	1b 45 9c             	sbb    -0x64(%ebp),%eax
c0107007:	73 1e                	jae    c0107027 <page_init+0x154>
c0107009:	ba ff ff ff 37       	mov    $0x37ffffff,%edx
c010700e:	b8 00 00 00 00       	mov    $0x0,%eax
c0107013:	3b 55 a0             	cmp    -0x60(%ebp),%edx
c0107016:	1b 45 a4             	sbb    -0x5c(%ebp),%eax
c0107019:	72 0c                	jb     c0107027 <page_init+0x154>
                maxpa = end;
c010701b:	8b 45 98             	mov    -0x68(%ebp),%eax
c010701e:	8b 55 9c             	mov    -0x64(%ebp),%edx
c0107021:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0107024:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    for (i = 0; i < memmap->nr_map; i ++) {
c0107027:	ff 45 dc             	incl   -0x24(%ebp)
c010702a:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c010702d:	8b 00                	mov    (%eax),%eax
c010702f:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c0107032:	0f 8c d8 fe ff ff    	jl     c0106f10 <page_init+0x3d>
            }
        }
    }
    if (maxpa > KMEMSIZE) {
c0107038:	ba 00 00 00 38       	mov    $0x38000000,%edx
c010703d:	b8 00 00 00 00       	mov    $0x0,%eax
c0107042:	3b 55 e0             	cmp    -0x20(%ebp),%edx
c0107045:	1b 45 e4             	sbb    -0x1c(%ebp),%eax
c0107048:	73 0e                	jae    c0107058 <page_init+0x185>
        maxpa = KMEMSIZE;
c010704a:	c7 45 e0 00 00 00 38 	movl   $0x38000000,-0x20(%ebp)
c0107051:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
    }

    extern char end[];

    npage = maxpa / PGSIZE;
c0107058:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010705b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c010705e:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0107062:	c1 ea 0c             	shr    $0xc,%edx
c0107065:	a3 80 bf 12 c0       	mov    %eax,0xc012bf80
    pages = (struct Page *)ROUNDUP((void *)end, PGSIZE);
c010706a:	c7 45 c0 00 10 00 00 	movl   $0x1000,-0x40(%ebp)
c0107071:	b8 4c e1 12 c0       	mov    $0xc012e14c,%eax
c0107076:	8d 50 ff             	lea    -0x1(%eax),%edx
c0107079:	8b 45 c0             	mov    -0x40(%ebp),%eax
c010707c:	01 d0                	add    %edx,%eax
c010707e:	89 45 bc             	mov    %eax,-0x44(%ebp)
c0107081:	8b 45 bc             	mov    -0x44(%ebp),%eax
c0107084:	ba 00 00 00 00       	mov    $0x0,%edx
c0107089:	f7 75 c0             	divl   -0x40(%ebp)
c010708c:	8b 45 bc             	mov    -0x44(%ebp),%eax
c010708f:	29 d0                	sub    %edx,%eax
c0107091:	a3 40 e1 12 c0       	mov    %eax,0xc012e140

    for (i = 0; i < npage; i ++) {
c0107096:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c010709d:	eb 27                	jmp    c01070c6 <page_init+0x1f3>
        SetPageReserved(pages + i);
c010709f:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c01070a4:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01070a7:	c1 e2 05             	shl    $0x5,%edx
c01070aa:	01 d0                	add    %edx,%eax
c01070ac:	83 c0 04             	add    $0x4,%eax
c01070af:	c7 45 94 00 00 00 00 	movl   $0x0,-0x6c(%ebp)
c01070b6:	89 45 90             	mov    %eax,-0x70(%ebp)
    asm volatile ("btsl %1, %0" :"=m" (*(volatile long *)addr) : "Ir" (nr));
c01070b9:	8b 45 90             	mov    -0x70(%ebp),%eax
c01070bc:	8b 55 94             	mov    -0x6c(%ebp),%edx
c01070bf:	0f ab 10             	bts    %edx,(%eax)
}
c01070c2:	90                   	nop
    for (i = 0; i < npage; i ++) {
c01070c3:	ff 45 dc             	incl   -0x24(%ebp)
c01070c6:	8b 55 dc             	mov    -0x24(%ebp),%edx
c01070c9:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c01070ce:	39 c2                	cmp    %eax,%edx
c01070d0:	72 cd                	jb     c010709f <page_init+0x1cc>
    }

    uintptr_t freemem = PADDR((uintptr_t)pages + sizeof(struct Page) * npage);
c01070d2:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c01070d7:	c1 e0 05             	shl    $0x5,%eax
c01070da:	89 c2                	mov    %eax,%edx
c01070dc:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c01070e1:	01 d0                	add    %edx,%eax
c01070e3:	89 45 b8             	mov    %eax,-0x48(%ebp)
c01070e6:	81 7d b8 ff ff ff bf 	cmpl   $0xbfffffff,-0x48(%ebp)
c01070ed:	77 23                	ja     c0107112 <page_init+0x23f>
c01070ef:	8b 45 b8             	mov    -0x48(%ebp),%eax
c01070f2:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01070f6:	c7 44 24 08 9c b9 10 	movl   $0xc010b99c,0x8(%esp)
c01070fd:	c0 
c01070fe:	c7 44 24 04 ea 00 00 	movl   $0xea,0x4(%esp)
c0107105:	00 
c0107106:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c010710d:	e8 2b 93 ff ff       	call   c010043d <__panic>
c0107112:	8b 45 b8             	mov    -0x48(%ebp),%eax
c0107115:	05 00 00 00 40       	add    $0x40000000,%eax
c010711a:	89 45 b4             	mov    %eax,-0x4c(%ebp)

    for (i = 0; i < memmap->nr_map; i ++) {
c010711d:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0107124:	e9 4b 01 00 00       	jmp    c0107274 <page_init+0x3a1>
        uint64_t begin = memmap->map[i].addr, end = begin + memmap->map[i].size;
c0107129:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c010712c:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010712f:	89 d0                	mov    %edx,%eax
c0107131:	c1 e0 02             	shl    $0x2,%eax
c0107134:	01 d0                	add    %edx,%eax
c0107136:	c1 e0 02             	shl    $0x2,%eax
c0107139:	01 c8                	add    %ecx,%eax
c010713b:	8b 50 08             	mov    0x8(%eax),%edx
c010713e:	8b 40 04             	mov    0x4(%eax),%eax
c0107141:	89 45 d0             	mov    %eax,-0x30(%ebp)
c0107144:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0107147:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c010714a:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010714d:	89 d0                	mov    %edx,%eax
c010714f:	c1 e0 02             	shl    $0x2,%eax
c0107152:	01 d0                	add    %edx,%eax
c0107154:	c1 e0 02             	shl    $0x2,%eax
c0107157:	01 c8                	add    %ecx,%eax
c0107159:	8b 48 0c             	mov    0xc(%eax),%ecx
c010715c:	8b 58 10             	mov    0x10(%eax),%ebx
c010715f:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107162:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0107165:	01 c8                	add    %ecx,%eax
c0107167:	11 da                	adc    %ebx,%edx
c0107169:	89 45 c8             	mov    %eax,-0x38(%ebp)
c010716c:	89 55 cc             	mov    %edx,-0x34(%ebp)
        if (memmap->map[i].type == E820_ARM) {
c010716f:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
c0107172:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0107175:	89 d0                	mov    %edx,%eax
c0107177:	c1 e0 02             	shl    $0x2,%eax
c010717a:	01 d0                	add    %edx,%eax
c010717c:	c1 e0 02             	shl    $0x2,%eax
c010717f:	01 c8                	add    %ecx,%eax
c0107181:	83 c0 14             	add    $0x14,%eax
c0107184:	8b 00                	mov    (%eax),%eax
c0107186:	83 f8 01             	cmp    $0x1,%eax
c0107189:	0f 85 e2 00 00 00    	jne    c0107271 <page_init+0x39e>
            if (begin < freemem) {
c010718f:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c0107192:	ba 00 00 00 00       	mov    $0x0,%edx
c0107197:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c010719a:	39 45 d0             	cmp    %eax,-0x30(%ebp)
c010719d:	19 d1                	sbb    %edx,%ecx
c010719f:	73 0d                	jae    c01071ae <page_init+0x2db>
                begin = freemem;
c01071a1:	8b 45 b4             	mov    -0x4c(%ebp),%eax
c01071a4:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01071a7:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
            }
            if (end > KMEMSIZE) {
c01071ae:	ba 00 00 00 38       	mov    $0x38000000,%edx
c01071b3:	b8 00 00 00 00       	mov    $0x0,%eax
c01071b8:	3b 55 c8             	cmp    -0x38(%ebp),%edx
c01071bb:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c01071be:	73 0e                	jae    c01071ce <page_init+0x2fb>
                end = KMEMSIZE;
c01071c0:	c7 45 c8 00 00 00 38 	movl   $0x38000000,-0x38(%ebp)
c01071c7:	c7 45 cc 00 00 00 00 	movl   $0x0,-0x34(%ebp)
            }
            if (begin < end) {
c01071ce:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01071d1:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01071d4:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c01071d7:	89 d0                	mov    %edx,%eax
c01071d9:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c01071dc:	0f 83 8f 00 00 00    	jae    c0107271 <page_init+0x39e>
                begin = ROUNDUP(begin, PGSIZE);
c01071e2:	c7 45 b0 00 10 00 00 	movl   $0x1000,-0x50(%ebp)
c01071e9:	8b 55 d0             	mov    -0x30(%ebp),%edx
c01071ec:	8b 45 b0             	mov    -0x50(%ebp),%eax
c01071ef:	01 d0                	add    %edx,%eax
c01071f1:	48                   	dec    %eax
c01071f2:	89 45 ac             	mov    %eax,-0x54(%ebp)
c01071f5:	8b 45 ac             	mov    -0x54(%ebp),%eax
c01071f8:	ba 00 00 00 00       	mov    $0x0,%edx
c01071fd:	f7 75 b0             	divl   -0x50(%ebp)
c0107200:	8b 45 ac             	mov    -0x54(%ebp),%eax
c0107203:	29 d0                	sub    %edx,%eax
c0107205:	ba 00 00 00 00       	mov    $0x0,%edx
c010720a:	89 45 d0             	mov    %eax,-0x30(%ebp)
c010720d:	89 55 d4             	mov    %edx,-0x2c(%ebp)
                end = ROUNDDOWN(end, PGSIZE);
c0107210:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0107213:	89 45 a8             	mov    %eax,-0x58(%ebp)
c0107216:	8b 45 a8             	mov    -0x58(%ebp),%eax
c0107219:	ba 00 00 00 00       	mov    $0x0,%edx
c010721e:	89 c3                	mov    %eax,%ebx
c0107220:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
c0107226:	89 de                	mov    %ebx,%esi
c0107228:	89 d0                	mov    %edx,%eax
c010722a:	83 e0 00             	and    $0x0,%eax
c010722d:	89 c7                	mov    %eax,%edi
c010722f:	89 75 c8             	mov    %esi,-0x38(%ebp)
c0107232:	89 7d cc             	mov    %edi,-0x34(%ebp)
                if (begin < end) {
c0107235:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0107238:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c010723b:	3b 45 c8             	cmp    -0x38(%ebp),%eax
c010723e:	89 d0                	mov    %edx,%eax
c0107240:	1b 45 cc             	sbb    -0x34(%ebp),%eax
c0107243:	73 2c                	jae    c0107271 <page_init+0x39e>
                    init_memmap(pa2page(begin), (end - begin) / PGSIZE);
c0107245:	8b 45 c8             	mov    -0x38(%ebp),%eax
c0107248:	8b 55 cc             	mov    -0x34(%ebp),%edx
c010724b:	2b 45 d0             	sub    -0x30(%ebp),%eax
c010724e:	1b 55 d4             	sbb    -0x2c(%ebp),%edx
c0107251:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0107255:	c1 ea 0c             	shr    $0xc,%edx
c0107258:	89 c3                	mov    %eax,%ebx
c010725a:	8b 45 d0             	mov    -0x30(%ebp),%eax
c010725d:	89 04 24             	mov    %eax,(%esp)
c0107260:	e8 94 f8 ff ff       	call   c0106af9 <pa2page>
c0107265:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0107269:	89 04 24             	mov    %eax,(%esp)
c010726c:	e8 69 fb ff ff       	call   c0106dda <init_memmap>
    for (i = 0; i < memmap->nr_map; i ++) {
c0107271:	ff 45 dc             	incl   -0x24(%ebp)
c0107274:	8b 45 c4             	mov    -0x3c(%ebp),%eax
c0107277:	8b 00                	mov    (%eax),%eax
c0107279:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c010727c:	0f 8c a7 fe ff ff    	jl     c0107129 <page_init+0x256>
                }
            }
        }
    }
}
c0107282:	90                   	nop
c0107283:	90                   	nop
c0107284:	81 c4 9c 00 00 00    	add    $0x9c,%esp
c010728a:	5b                   	pop    %ebx
c010728b:	5e                   	pop    %esi
c010728c:	5f                   	pop    %edi
c010728d:	5d                   	pop    %ebp
c010728e:	c3                   	ret    

c010728f <boot_map_segment>:
//  la:   linear address of this memory need to map (after x86 segment map)
//  size: memory size
//  pa:   physical address of this memory
//  perm: permission of this memory  
static void
boot_map_segment(pde_t *pgdir, uintptr_t la, size_t size, uintptr_t pa, uint32_t perm) {
c010728f:	f3 0f 1e fb          	endbr32 
c0107293:	55                   	push   %ebp
c0107294:	89 e5                	mov    %esp,%ebp
c0107296:	83 ec 38             	sub    $0x38,%esp
    assert(PGOFF(la) == PGOFF(pa));
c0107299:	8b 45 0c             	mov    0xc(%ebp),%eax
c010729c:	33 45 14             	xor    0x14(%ebp),%eax
c010729f:	25 ff 0f 00 00       	and    $0xfff,%eax
c01072a4:	85 c0                	test   %eax,%eax
c01072a6:	74 24                	je     c01072cc <boot_map_segment+0x3d>
c01072a8:	c7 44 24 0c ce b9 10 	movl   $0xc010b9ce,0xc(%esp)
c01072af:	c0 
c01072b0:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c01072b7:	c0 
c01072b8:	c7 44 24 04 08 01 00 	movl   $0x108,0x4(%esp)
c01072bf:	00 
c01072c0:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01072c7:	e8 71 91 ff ff       	call   c010043d <__panic>
    size_t n = ROUNDUP(size + PGOFF(la), PGSIZE) / PGSIZE;
c01072cc:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
c01072d3:	8b 45 0c             	mov    0xc(%ebp),%eax
c01072d6:	25 ff 0f 00 00       	and    $0xfff,%eax
c01072db:	89 c2                	mov    %eax,%edx
c01072dd:	8b 45 10             	mov    0x10(%ebp),%eax
c01072e0:	01 c2                	add    %eax,%edx
c01072e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01072e5:	01 d0                	add    %edx,%eax
c01072e7:	48                   	dec    %eax
c01072e8:	89 45 ec             	mov    %eax,-0x14(%ebp)
c01072eb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01072ee:	ba 00 00 00 00       	mov    $0x0,%edx
c01072f3:	f7 75 f0             	divl   -0x10(%ebp)
c01072f6:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01072f9:	29 d0                	sub    %edx,%eax
c01072fb:	c1 e8 0c             	shr    $0xc,%eax
c01072fe:	89 45 f4             	mov    %eax,-0xc(%ebp)
    la = ROUNDDOWN(la, PGSIZE);
c0107301:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107304:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107307:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010730a:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010730f:	89 45 0c             	mov    %eax,0xc(%ebp)
    pa = ROUNDDOWN(pa, PGSIZE);
c0107312:	8b 45 14             	mov    0x14(%ebp),%eax
c0107315:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0107318:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c010731b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0107320:	89 45 14             	mov    %eax,0x14(%ebp)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c0107323:	eb 68                	jmp    c010738d <boot_map_segment+0xfe>
        pte_t *ptep = get_pte(pgdir, la, 1);
c0107325:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c010732c:	00 
c010732d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107330:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107334:	8b 45 08             	mov    0x8(%ebp),%eax
c0107337:	89 04 24             	mov    %eax,(%esp)
c010733a:	e8 8f 01 00 00       	call   c01074ce <get_pte>
c010733f:	89 45 e0             	mov    %eax,-0x20(%ebp)
        assert(ptep != NULL);
c0107342:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
c0107346:	75 24                	jne    c010736c <boot_map_segment+0xdd>
c0107348:	c7 44 24 0c fa b9 10 	movl   $0xc010b9fa,0xc(%esp)
c010734f:	c0 
c0107350:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107357:	c0 
c0107358:	c7 44 24 04 0e 01 00 	movl   $0x10e,0x4(%esp)
c010735f:	00 
c0107360:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107367:	e8 d1 90 ff ff       	call   c010043d <__panic>
        *ptep = pa | PTE_P | perm;
c010736c:	8b 45 14             	mov    0x14(%ebp),%eax
c010736f:	0b 45 18             	or     0x18(%ebp),%eax
c0107372:	83 c8 01             	or     $0x1,%eax
c0107375:	89 c2                	mov    %eax,%edx
c0107377:	8b 45 e0             	mov    -0x20(%ebp),%eax
c010737a:	89 10                	mov    %edx,(%eax)
    for (; n > 0; n --, la += PGSIZE, pa += PGSIZE) {
c010737c:	ff 4d f4             	decl   -0xc(%ebp)
c010737f:	81 45 0c 00 10 00 00 	addl   $0x1000,0xc(%ebp)
c0107386:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
c010738d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107391:	75 92                	jne    c0107325 <boot_map_segment+0x96>
    }
}
c0107393:	90                   	nop
c0107394:	90                   	nop
c0107395:	c9                   	leave  
c0107396:	c3                   	ret    

c0107397 <boot_alloc_page>:

//boot_alloc_page - allocate one page using pmm->alloc_pages(1) 
// return value: the kernel virtual address of this allocated page
//note: this function is used to get the memory for PDT(Page Directory Table)&PT(Page Table)
static void *
boot_alloc_page(void) {
c0107397:	f3 0f 1e fb          	endbr32 
c010739b:	55                   	push   %ebp
c010739c:	89 e5                	mov    %esp,%ebp
c010739e:	83 ec 28             	sub    $0x28,%esp
    struct Page *p = alloc_page();
c01073a1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01073a8:	e8 51 fa ff ff       	call   c0106dfe <alloc_pages>
c01073ad:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (p == NULL) {
c01073b0:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01073b4:	75 1c                	jne    c01073d2 <boot_alloc_page+0x3b>
        panic("boot_alloc_page failed.\n");
c01073b6:	c7 44 24 08 07 ba 10 	movl   $0xc010ba07,0x8(%esp)
c01073bd:	c0 
c01073be:	c7 44 24 04 1a 01 00 	movl   $0x11a,0x4(%esp)
c01073c5:	00 
c01073c6:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01073cd:	e8 6b 90 ff ff       	call   c010043d <__panic>
    }
    return page2kva(p);
c01073d2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01073d5:	89 04 24             	mov    %eax,(%esp)
c01073d8:	e8 61 f7 ff ff       	call   c0106b3e <page2kva>
}
c01073dd:	c9                   	leave  
c01073de:	c3                   	ret    

c01073df <pmm_init>:

//pmm_init - setup a pmm to manage physical memory, build PDT&PT to setup paging mechanism 
//         - check the correctness of pmm & paging mechanism, print PDT&PT
void
pmm_init(void) {
c01073df:	f3 0f 1e fb          	endbr32 
c01073e3:	55                   	push   %ebp
c01073e4:	89 e5                	mov    %esp,%ebp
c01073e6:	83 ec 38             	sub    $0x38,%esp
    // We've already enabled paging
    boot_cr3 = PADDR(boot_pgdir);
c01073e9:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c01073ee:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01073f1:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c01073f8:	77 23                	ja     c010741d <pmm_init+0x3e>
c01073fa:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01073fd:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107401:	c7 44 24 08 9c b9 10 	movl   $0xc010b99c,0x8(%esp)
c0107408:	c0 
c0107409:	c7 44 24 04 24 01 00 	movl   $0x124,0x4(%esp)
c0107410:	00 
c0107411:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107418:	e8 20 90 ff ff       	call   c010043d <__panic>
c010741d:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107420:	05 00 00 00 40       	add    $0x40000000,%eax
c0107425:	a3 3c e1 12 c0       	mov    %eax,0xc012e13c
    //We need to alloc/free the physical memory (granularity is 4KB or other size). 
    //So a framework of physical memory manager (struct pmm_manager)is defined in pmm.h
    //First we should init a physical memory manager(pmm) based on the framework.
    //Then pmm can alloc/free the physical memory. 
    //Now the first_fit/best_fit/worst_fit/buddy_system pmm are available.
    init_pmm_manager();
c010742a:	e8 73 f9 ff ff       	call   c0106da2 <init_pmm_manager>

    // detect physical memory space, reserve already used memory,
    // then use pmm->init_memmap to create free page list
    page_init();
c010742f:	e8 9f fa ff ff       	call   c0106ed3 <page_init>

    //use pmm->check to verify the correctness of the alloc/free function in a pmm
    check_alloc_page();
c0107434:	e8 c7 04 00 00       	call   c0107900 <check_alloc_page>

    check_pgdir();
c0107439:	e8 e5 04 00 00       	call   c0107923 <check_pgdir>

    static_assert(KERNBASE % PTSIZE == 0 && KERNTOP % PTSIZE == 0);

    // recursively insert boot_pgdir in itself
    // to form a virtual page table at virtual address VPT
    boot_pgdir[PDX(VPT)] = PADDR(boot_pgdir) | PTE_P | PTE_W;
c010743e:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107443:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107446:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c010744d:	77 23                	ja     c0107472 <pmm_init+0x93>
c010744f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107452:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107456:	c7 44 24 08 9c b9 10 	movl   $0xc010b99c,0x8(%esp)
c010745d:	c0 
c010745e:	c7 44 24 04 3a 01 00 	movl   $0x13a,0x4(%esp)
c0107465:	00 
c0107466:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c010746d:	e8 cb 8f ff ff       	call   c010043d <__panic>
c0107472:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107475:	8d 90 00 00 00 40    	lea    0x40000000(%eax),%edx
c010747b:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107480:	05 ac 0f 00 00       	add    $0xfac,%eax
c0107485:	83 ca 03             	or     $0x3,%edx
c0107488:	89 10                	mov    %edx,(%eax)

    // map all physical memory to linear memory with base linear addr KERNBASE
    // linear_addr KERNBASE ~ KERNBASE + KMEMSIZE = phy_addr 0 ~ KMEMSIZE
    boot_map_segment(boot_pgdir, KERNBASE, KMEMSIZE, 0, PTE_W);
c010748a:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c010748f:	c7 44 24 10 02 00 00 	movl   $0x2,0x10(%esp)
c0107496:	00 
c0107497:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c010749e:	00 
c010749f:	c7 44 24 08 00 00 00 	movl   $0x38000000,0x8(%esp)
c01074a6:	38 
c01074a7:	c7 44 24 04 00 00 00 	movl   $0xc0000000,0x4(%esp)
c01074ae:	c0 
c01074af:	89 04 24             	mov    %eax,(%esp)
c01074b2:	e8 d8 fd ff ff       	call   c010728f <boot_map_segment>

    // Since we are using bootloader's GDT,
    // we should reload gdt (second time, the last time) to get user segments and the TSS
    // map virtual_addr 0 ~ 4G = linear_addr 0 ~ 4G
    // then set kernel stack (ss:esp) in TSS, setup TSS in gdt, load TSS
    gdt_init();
c01074b7:	e8 f8 f7 ff ff       	call   c0106cb4 <gdt_init>

    //now the basic virtual memory map(see memalyout.h) is established.
    //check the correctness of the basic virtual memory map.
    check_boot_pgdir();
c01074bc:	e8 02 0b 00 00       	call   c0107fc3 <check_boot_pgdir>

    print_pgdir();
c01074c1:	e8 87 0f 00 00       	call   c010844d <print_pgdir>
    
    kmalloc_init();
c01074c6:	e8 d9 db ff ff       	call   c01050a4 <kmalloc_init>

}
c01074cb:	90                   	nop
c01074cc:	c9                   	leave  
c01074cd:	c3                   	ret    

c01074ce <get_pte>:
//  pgdir:  the kernel virtual base address of PDT
//  la:     the linear address need to map
//  create: a logical value to decide if alloc a page for PT
// return vaule: the kernel virtual address of this pte
pte_t *
get_pte(pde_t *pgdir, uintptr_t la, bool create) {
c01074ce:	f3 0f 1e fb          	endbr32 
c01074d2:	55                   	push   %ebp
c01074d3:	89 e5                	mov    %esp,%ebp
c01074d5:	83 ec 38             	sub    $0x38,%esp
                          // (6) clear page content using memset
                          // (7) set page directory entry's permission
    }
    return NULL;          // (8) return page table entry
#endif
    pde_t *pdep = &pgdir[PDX(la)];
c01074d8:	8b 45 0c             	mov    0xc(%ebp),%eax
c01074db:	c1 e8 16             	shr    $0x16,%eax
c01074de:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01074e5:	8b 45 08             	mov    0x8(%ebp),%eax
c01074e8:	01 d0                	add    %edx,%eax
c01074ea:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (!(*pdep & PTE_P)) {
c01074ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01074f0:	8b 00                	mov    (%eax),%eax
c01074f2:	83 e0 01             	and    $0x1,%eax
c01074f5:	85 c0                	test   %eax,%eax
c01074f7:	0f 85 af 00 00 00    	jne    c01075ac <get_pte+0xde>
        struct Page *page;
        if (!create || (page = alloc_page()) == NULL) {
c01074fd:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0107501:	74 15                	je     c0107518 <get_pte+0x4a>
c0107503:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010750a:	e8 ef f8 ff ff       	call   c0106dfe <alloc_pages>
c010750f:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107512:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107516:	75 0a                	jne    c0107522 <get_pte+0x54>
            return NULL;
c0107518:	b8 00 00 00 00       	mov    $0x0,%eax
c010751d:	e9 e7 00 00 00       	jmp    c0107609 <get_pte+0x13b>
        }
        set_page_ref(page, 1);
c0107522:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107529:	00 
c010752a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010752d:	89 04 24             	mov    %eax,(%esp)
c0107530:	e8 bd f6 ff ff       	call   c0106bf2 <set_page_ref>
        uintptr_t pa = page2pa(page);
c0107535:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107538:	89 04 24             	mov    %eax,(%esp)
c010753b:	e8 a3 f5 ff ff       	call   c0106ae3 <page2pa>
c0107540:	89 45 ec             	mov    %eax,-0x14(%ebp)
        memset(KADDR(pa), 0, PGSIZE);
c0107543:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107546:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107549:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010754c:	c1 e8 0c             	shr    $0xc,%eax
c010754f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0107552:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0107557:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
c010755a:	72 23                	jb     c010757f <get_pte+0xb1>
c010755c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010755f:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107563:	c7 44 24 08 f8 b8 10 	movl   $0xc010b8f8,0x8(%esp)
c010756a:	c0 
c010756b:	c7 44 24 04 82 01 00 	movl   $0x182,0x4(%esp)
c0107572:	00 
c0107573:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c010757a:	e8 be 8e ff ff       	call   c010043d <__panic>
c010757f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0107582:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0107587:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c010758e:	00 
c010758f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0107596:	00 
c0107597:	89 04 24             	mov    %eax,(%esp)
c010759a:	e8 9f 21 00 00       	call   c010973e <memset>
        *pdep = pa | PTE_U | PTE_W | PTE_P;
c010759f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01075a2:	83 c8 07             	or     $0x7,%eax
c01075a5:	89 c2                	mov    %eax,%edx
c01075a7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01075aa:	89 10                	mov    %edx,(%eax)
    }
    return &((pte_t *)KADDR(PDE_ADDR(*pdep)))[PTX(la)];
c01075ac:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01075af:	8b 00                	mov    (%eax),%eax
c01075b1:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01075b6:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01075b9:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01075bc:	c1 e8 0c             	shr    $0xc,%eax
c01075bf:	89 45 dc             	mov    %eax,-0x24(%ebp)
c01075c2:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c01075c7:	39 45 dc             	cmp    %eax,-0x24(%ebp)
c01075ca:	72 23                	jb     c01075ef <get_pte+0x121>
c01075cc:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01075cf:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01075d3:	c7 44 24 08 f8 b8 10 	movl   $0xc010b8f8,0x8(%esp)
c01075da:	c0 
c01075db:	c7 44 24 04 85 01 00 	movl   $0x185,0x4(%esp)
c01075e2:	00 
c01075e3:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01075ea:	e8 4e 8e ff ff       	call   c010043d <__panic>
c01075ef:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01075f2:	2d 00 00 00 40       	sub    $0x40000000,%eax
c01075f7:	89 c2                	mov    %eax,%edx
c01075f9:	8b 45 0c             	mov    0xc(%ebp),%eax
c01075fc:	c1 e8 0c             	shr    $0xc,%eax
c01075ff:	25 ff 03 00 00       	and    $0x3ff,%eax
c0107604:	c1 e0 02             	shl    $0x2,%eax
c0107607:	01 d0                	add    %edx,%eax
}
c0107609:	c9                   	leave  
c010760a:	c3                   	ret    

c010760b <get_page>:

//get_page - get related Page struct for linear address la using PDT pgdir
struct Page *
get_page(pde_t *pgdir, uintptr_t la, pte_t **ptep_store) {
c010760b:	f3 0f 1e fb          	endbr32 
c010760f:	55                   	push   %ebp
c0107610:	89 e5                	mov    %esp,%ebp
c0107612:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c0107615:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010761c:	00 
c010761d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107620:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107624:	8b 45 08             	mov    0x8(%ebp),%eax
c0107627:	89 04 24             	mov    %eax,(%esp)
c010762a:	e8 9f fe ff ff       	call   c01074ce <get_pte>
c010762f:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep_store != NULL) {
c0107632:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0107636:	74 08                	je     c0107640 <get_page+0x35>
        *ptep_store = ptep;
c0107638:	8b 45 10             	mov    0x10(%ebp),%eax
c010763b:	8b 55 f4             	mov    -0xc(%ebp),%edx
c010763e:	89 10                	mov    %edx,(%eax)
    }
    if (ptep != NULL && *ptep & PTE_P) {
c0107640:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0107644:	74 1b                	je     c0107661 <get_page+0x56>
c0107646:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107649:	8b 00                	mov    (%eax),%eax
c010764b:	83 e0 01             	and    $0x1,%eax
c010764e:	85 c0                	test   %eax,%eax
c0107650:	74 0f                	je     c0107661 <get_page+0x56>
        return pte2page(*ptep);
c0107652:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107655:	8b 00                	mov    (%eax),%eax
c0107657:	89 04 24             	mov    %eax,(%esp)
c010765a:	e8 33 f5 ff ff       	call   c0106b92 <pte2page>
c010765f:	eb 05                	jmp    c0107666 <get_page+0x5b>
    }
    return NULL;
c0107661:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0107666:	c9                   	leave  
c0107667:	c3                   	ret    

c0107668 <page_remove_pte>:

//page_remove_pte - free an Page sturct which is related linear address la
//                - and clean(invalidate) pte which is related linear address la
//note: PT is changed, so the TLB need to be invalidate 
static inline void
page_remove_pte(pde_t *pgdir, uintptr_t la, pte_t *ptep) {
c0107668:	55                   	push   %ebp
c0107669:	89 e5                	mov    %esp,%ebp
c010766b:	83 ec 28             	sub    $0x28,%esp
                                  //(4) and free this page when page reference reachs 0
                                  //(5) clear second page table entry
                                  //(6) flush tlb
    }
#endif
    if (*ptep & PTE_P) {
c010766e:	8b 45 10             	mov    0x10(%ebp),%eax
c0107671:	8b 00                	mov    (%eax),%eax
c0107673:	83 e0 01             	and    $0x1,%eax
c0107676:	85 c0                	test   %eax,%eax
c0107678:	74 4d                	je     c01076c7 <page_remove_pte+0x5f>
        struct Page *page = pte2page(*ptep);
c010767a:	8b 45 10             	mov    0x10(%ebp),%eax
c010767d:	8b 00                	mov    (%eax),%eax
c010767f:	89 04 24             	mov    %eax,(%esp)
c0107682:	e8 0b f5 ff ff       	call   c0106b92 <pte2page>
c0107687:	89 45 f4             	mov    %eax,-0xc(%ebp)
        if (page_ref_dec(page) == 0) {
c010768a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010768d:	89 04 24             	mov    %eax,(%esp)
c0107690:	e8 82 f5 ff ff       	call   c0106c17 <page_ref_dec>
c0107695:	85 c0                	test   %eax,%eax
c0107697:	75 13                	jne    c01076ac <page_remove_pte+0x44>
            free_page(page);
c0107699:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c01076a0:	00 
c01076a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01076a4:	89 04 24             	mov    %eax,(%esp)
c01076a7:	e8 c1 f7 ff ff       	call   c0106e6d <free_pages>
        }
        *ptep = 0;
c01076ac:	8b 45 10             	mov    0x10(%ebp),%eax
c01076af:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
        tlb_invalidate(pgdir, la);
c01076b5:	8b 45 0c             	mov    0xc(%ebp),%eax
c01076b8:	89 44 24 04          	mov    %eax,0x4(%esp)
c01076bc:	8b 45 08             	mov    0x8(%ebp),%eax
c01076bf:	89 04 24             	mov    %eax,(%esp)
c01076c2:	e8 09 01 00 00       	call   c01077d0 <tlb_invalidate>
    }
}
c01076c7:	90                   	nop
c01076c8:	c9                   	leave  
c01076c9:	c3                   	ret    

c01076ca <page_remove>:

//page_remove - free an Page which is related linear address la and has an validated pte
void
page_remove(pde_t *pgdir, uintptr_t la) {
c01076ca:	f3 0f 1e fb          	endbr32 
c01076ce:	55                   	push   %ebp
c01076cf:	89 e5                	mov    %esp,%ebp
c01076d1:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 0);
c01076d4:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01076db:	00 
c01076dc:	8b 45 0c             	mov    0xc(%ebp),%eax
c01076df:	89 44 24 04          	mov    %eax,0x4(%esp)
c01076e3:	8b 45 08             	mov    0x8(%ebp),%eax
c01076e6:	89 04 24             	mov    %eax,(%esp)
c01076e9:	e8 e0 fd ff ff       	call   c01074ce <get_pte>
c01076ee:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep != NULL) {
c01076f1:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01076f5:	74 19                	je     c0107710 <page_remove+0x46>
        page_remove_pte(pgdir, la, ptep);
c01076f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01076fa:	89 44 24 08          	mov    %eax,0x8(%esp)
c01076fe:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107701:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107705:	8b 45 08             	mov    0x8(%ebp),%eax
c0107708:	89 04 24             	mov    %eax,(%esp)
c010770b:	e8 58 ff ff ff       	call   c0107668 <page_remove_pte>
    }
}
c0107710:	90                   	nop
c0107711:	c9                   	leave  
c0107712:	c3                   	ret    

c0107713 <page_insert>:
//  la:    the linear address need to map
//  perm:  the permission of this Page which is setted in related pte
// return value: always 0
//note: PT is changed, so the TLB need to be invalidate 
int
page_insert(pde_t *pgdir, struct Page *page, uintptr_t la, uint32_t perm) {
c0107713:	f3 0f 1e fb          	endbr32 
c0107717:	55                   	push   %ebp
c0107718:	89 e5                	mov    %esp,%ebp
c010771a:	83 ec 28             	sub    $0x28,%esp
    pte_t *ptep = get_pte(pgdir, la, 1);
c010771d:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
c0107724:	00 
c0107725:	8b 45 10             	mov    0x10(%ebp),%eax
c0107728:	89 44 24 04          	mov    %eax,0x4(%esp)
c010772c:	8b 45 08             	mov    0x8(%ebp),%eax
c010772f:	89 04 24             	mov    %eax,(%esp)
c0107732:	e8 97 fd ff ff       	call   c01074ce <get_pte>
c0107737:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (ptep == NULL) {
c010773a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010773e:	75 0a                	jne    c010774a <page_insert+0x37>
        return -E_NO_MEM;
c0107740:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
c0107745:	e9 84 00 00 00       	jmp    c01077ce <page_insert+0xbb>
    }
    page_ref_inc(page);
c010774a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010774d:	89 04 24             	mov    %eax,(%esp)
c0107750:	e8 ab f4 ff ff       	call   c0106c00 <page_ref_inc>
    if (*ptep & PTE_P) {
c0107755:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107758:	8b 00                	mov    (%eax),%eax
c010775a:	83 e0 01             	and    $0x1,%eax
c010775d:	85 c0                	test   %eax,%eax
c010775f:	74 3e                	je     c010779f <page_insert+0x8c>
        struct Page *p = pte2page(*ptep);
c0107761:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107764:	8b 00                	mov    (%eax),%eax
c0107766:	89 04 24             	mov    %eax,(%esp)
c0107769:	e8 24 f4 ff ff       	call   c0106b92 <pte2page>
c010776e:	89 45 f0             	mov    %eax,-0x10(%ebp)
        if (p == page) {
c0107771:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107774:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0107777:	75 0d                	jne    c0107786 <page_insert+0x73>
            page_ref_dec(page);
c0107779:	8b 45 0c             	mov    0xc(%ebp),%eax
c010777c:	89 04 24             	mov    %eax,(%esp)
c010777f:	e8 93 f4 ff ff       	call   c0106c17 <page_ref_dec>
c0107784:	eb 19                	jmp    c010779f <page_insert+0x8c>
        }
        else {
            page_remove_pte(pgdir, la, ptep);
c0107786:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107789:	89 44 24 08          	mov    %eax,0x8(%esp)
c010778d:	8b 45 10             	mov    0x10(%ebp),%eax
c0107790:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107794:	8b 45 08             	mov    0x8(%ebp),%eax
c0107797:	89 04 24             	mov    %eax,(%esp)
c010779a:	e8 c9 fe ff ff       	call   c0107668 <page_remove_pte>
        }
    }
    *ptep = page2pa(page) | PTE_P | perm;
c010779f:	8b 45 0c             	mov    0xc(%ebp),%eax
c01077a2:	89 04 24             	mov    %eax,(%esp)
c01077a5:	e8 39 f3 ff ff       	call   c0106ae3 <page2pa>
c01077aa:	0b 45 14             	or     0x14(%ebp),%eax
c01077ad:	83 c8 01             	or     $0x1,%eax
c01077b0:	89 c2                	mov    %eax,%edx
c01077b2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01077b5:	89 10                	mov    %edx,(%eax)
    tlb_invalidate(pgdir, la);
c01077b7:	8b 45 10             	mov    0x10(%ebp),%eax
c01077ba:	89 44 24 04          	mov    %eax,0x4(%esp)
c01077be:	8b 45 08             	mov    0x8(%ebp),%eax
c01077c1:	89 04 24             	mov    %eax,(%esp)
c01077c4:	e8 07 00 00 00       	call   c01077d0 <tlb_invalidate>
    return 0;
c01077c9:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01077ce:	c9                   	leave  
c01077cf:	c3                   	ret    

c01077d0 <tlb_invalidate>:

// invalidate a TLB entry, but only if the page tables being
// edited are the ones currently in use by the processor.
void
tlb_invalidate(pde_t *pgdir, uintptr_t la) {
c01077d0:	f3 0f 1e fb          	endbr32 
c01077d4:	55                   	push   %ebp
c01077d5:	89 e5                	mov    %esp,%ebp
c01077d7:	83 ec 28             	sub    $0x28,%esp
}

static inline uintptr_t
rcr3(void) {
    uintptr_t cr3;
    asm volatile ("mov %%cr3, %0" : "=r" (cr3) :: "memory");
c01077da:	0f 20 d8             	mov    %cr3,%eax
c01077dd:	89 45 f0             	mov    %eax,-0x10(%ebp)
    return cr3;
c01077e0:	8b 55 f0             	mov    -0x10(%ebp),%edx
    if (rcr3() == PADDR(pgdir)) {
c01077e3:	8b 45 08             	mov    0x8(%ebp),%eax
c01077e6:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01077e9:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c01077f0:	77 23                	ja     c0107815 <tlb_invalidate+0x45>
c01077f2:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01077f5:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01077f9:	c7 44 24 08 9c b9 10 	movl   $0xc010b99c,0x8(%esp)
c0107800:	c0 
c0107801:	c7 44 24 04 e7 01 00 	movl   $0x1e7,0x4(%esp)
c0107808:	00 
c0107809:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107810:	e8 28 8c ff ff       	call   c010043d <__panic>
c0107815:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107818:	05 00 00 00 40       	add    $0x40000000,%eax
c010781d:	39 d0                	cmp    %edx,%eax
c010781f:	75 0d                	jne    c010782e <tlb_invalidate+0x5e>
        invlpg((void *)la);
c0107821:	8b 45 0c             	mov    0xc(%ebp),%eax
c0107824:	89 45 ec             	mov    %eax,-0x14(%ebp)
}

static inline void
invlpg(void *addr) {
    asm volatile ("invlpg (%0)" :: "r" (addr) : "memory");
c0107827:	8b 45 ec             	mov    -0x14(%ebp),%eax
c010782a:	0f 01 38             	invlpg (%eax)
}
c010782d:	90                   	nop
    }
}
c010782e:	90                   	nop
c010782f:	c9                   	leave  
c0107830:	c3                   	ret    

c0107831 <pgdir_alloc_page>:

// pgdir_alloc_page - call alloc_page & page_insert functions to 
//                  - allocate a page size memory & setup an addr map
//                  - pa<->la with linear address la and the PDT pgdir
struct Page *
pgdir_alloc_page(pde_t *pgdir, uintptr_t la, uint32_t perm) {
c0107831:	f3 0f 1e fb          	endbr32 
c0107835:	55                   	push   %ebp
c0107836:	89 e5                	mov    %esp,%ebp
c0107838:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_page();
c010783b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107842:	e8 b7 f5 ff ff       	call   c0106dfe <alloc_pages>
c0107847:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c010784a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010784e:	0f 84 a7 00 00 00    	je     c01078fb <pgdir_alloc_page+0xca>
        if (page_insert(pgdir, page, la, perm) != 0) {
c0107854:	8b 45 10             	mov    0x10(%ebp),%eax
c0107857:	89 44 24 0c          	mov    %eax,0xc(%esp)
c010785b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010785e:	89 44 24 08          	mov    %eax,0x8(%esp)
c0107862:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107865:	89 44 24 04          	mov    %eax,0x4(%esp)
c0107869:	8b 45 08             	mov    0x8(%ebp),%eax
c010786c:	89 04 24             	mov    %eax,(%esp)
c010786f:	e8 9f fe ff ff       	call   c0107713 <page_insert>
c0107874:	85 c0                	test   %eax,%eax
c0107876:	74 1a                	je     c0107892 <pgdir_alloc_page+0x61>
            free_page(page);
c0107878:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010787f:	00 
c0107880:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107883:	89 04 24             	mov    %eax,(%esp)
c0107886:	e8 e2 f5 ff ff       	call   c0106e6d <free_pages>
            return NULL;
c010788b:	b8 00 00 00 00       	mov    $0x0,%eax
c0107890:	eb 6c                	jmp    c01078fe <pgdir_alloc_page+0xcd>
        }
        if (swap_init_ok){
c0107892:	a1 68 bf 12 c0       	mov    0xc012bf68,%eax
c0107897:	85 c0                	test   %eax,%eax
c0107899:	74 60                	je     c01078fb <pgdir_alloc_page+0xca>
            swap_map_swappable(check_mm_struct, la, page, 0);
c010789b:	a1 58 e0 12 c0       	mov    0xc012e058,%eax
c01078a0:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c01078a7:	00 
c01078a8:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01078ab:	89 54 24 08          	mov    %edx,0x8(%esp)
c01078af:	8b 55 0c             	mov    0xc(%ebp),%edx
c01078b2:	89 54 24 04          	mov    %edx,0x4(%esp)
c01078b6:	89 04 24             	mov    %eax,(%esp)
c01078b9:	e8 48 c8 ff ff       	call   c0104106 <swap_map_swappable>
            page->pra_vaddr=la;
c01078be:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078c1:	8b 55 0c             	mov    0xc(%ebp),%edx
c01078c4:	89 50 1c             	mov    %edx,0x1c(%eax)
            assert(page_ref(page) == 1);
c01078c7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01078ca:	89 04 24             	mov    %eax,(%esp)
c01078cd:	e8 16 f3 ff ff       	call   c0106be8 <page_ref>
c01078d2:	83 f8 01             	cmp    $0x1,%eax
c01078d5:	74 24                	je     c01078fb <pgdir_alloc_page+0xca>
c01078d7:	c7 44 24 0c 20 ba 10 	movl   $0xc010ba20,0xc(%esp)
c01078de:	c0 
c01078df:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c01078e6:	c0 
c01078e7:	c7 44 24 04 fa 01 00 	movl   $0x1fa,0x4(%esp)
c01078ee:	00 
c01078ef:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01078f6:	e8 42 8b ff ff       	call   c010043d <__panic>
            //cprintf("get No. %d  page: pra_vaddr %x, pra_link.prev %x, pra_link_next %x in pgdir_alloc_page\n", (page-pages), page->pra_vaddr,page->pra_page_link.prev, page->pra_page_link.next);
        }

    }

    return page;
c01078fb:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01078fe:	c9                   	leave  
c01078ff:	c3                   	ret    

c0107900 <check_alloc_page>:

static void
check_alloc_page(void) {
c0107900:	f3 0f 1e fb          	endbr32 
c0107904:	55                   	push   %ebp
c0107905:	89 e5                	mov    %esp,%ebp
c0107907:	83 ec 18             	sub    $0x18,%esp
    pmm_manager->check();
c010790a:	a1 38 e1 12 c0       	mov    0xc012e138,%eax
c010790f:	8b 40 18             	mov    0x18(%eax),%eax
c0107912:	ff d0                	call   *%eax
    cprintf("check_alloc_page() succeeded!\n");
c0107914:	c7 04 24 34 ba 10 c0 	movl   $0xc010ba34,(%esp)
c010791b:	e8 b1 89 ff ff       	call   c01002d1 <cprintf>
}
c0107920:	90                   	nop
c0107921:	c9                   	leave  
c0107922:	c3                   	ret    

c0107923 <check_pgdir>:

static void
check_pgdir(void) {
c0107923:	f3 0f 1e fb          	endbr32 
c0107927:	55                   	push   %ebp
c0107928:	89 e5                	mov    %esp,%ebp
c010792a:	83 ec 38             	sub    $0x38,%esp
    assert(npage <= KMEMSIZE / PGSIZE);
c010792d:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0107932:	3d 00 80 03 00       	cmp    $0x38000,%eax
c0107937:	76 24                	jbe    c010795d <check_pgdir+0x3a>
c0107939:	c7 44 24 0c 53 ba 10 	movl   $0xc010ba53,0xc(%esp)
c0107940:	c0 
c0107941:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107948:	c0 
c0107949:	c7 44 24 04 0b 02 00 	movl   $0x20b,0x4(%esp)
c0107950:	00 
c0107951:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107958:	e8 e0 8a ff ff       	call   c010043d <__panic>
    assert(boot_pgdir != NULL && (uint32_t)PGOFF(boot_pgdir) == 0);
c010795d:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107962:	85 c0                	test   %eax,%eax
c0107964:	74 0e                	je     c0107974 <check_pgdir+0x51>
c0107966:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c010796b:	25 ff 0f 00 00       	and    $0xfff,%eax
c0107970:	85 c0                	test   %eax,%eax
c0107972:	74 24                	je     c0107998 <check_pgdir+0x75>
c0107974:	c7 44 24 0c 70 ba 10 	movl   $0xc010ba70,0xc(%esp)
c010797b:	c0 
c010797c:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107983:	c0 
c0107984:	c7 44 24 04 0c 02 00 	movl   $0x20c,0x4(%esp)
c010798b:	00 
c010798c:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107993:	e8 a5 8a ff ff       	call   c010043d <__panic>
    assert(get_page(boot_pgdir, 0x0, NULL) == NULL);
c0107998:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c010799d:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01079a4:	00 
c01079a5:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01079ac:	00 
c01079ad:	89 04 24             	mov    %eax,(%esp)
c01079b0:	e8 56 fc ff ff       	call   c010760b <get_page>
c01079b5:	85 c0                	test   %eax,%eax
c01079b7:	74 24                	je     c01079dd <check_pgdir+0xba>
c01079b9:	c7 44 24 0c a8 ba 10 	movl   $0xc010baa8,0xc(%esp)
c01079c0:	c0 
c01079c1:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c01079c8:	c0 
c01079c9:	c7 44 24 04 0d 02 00 	movl   $0x20d,0x4(%esp)
c01079d0:	00 
c01079d1:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01079d8:	e8 60 8a ff ff       	call   c010043d <__panic>

    struct Page *p1, *p2;
    p1 = alloc_page();
c01079dd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01079e4:	e8 15 f4 ff ff       	call   c0106dfe <alloc_pages>
c01079e9:	89 45 f4             	mov    %eax,-0xc(%ebp)
    assert(page_insert(boot_pgdir, p1, 0x0, 0) == 0);
c01079ec:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c01079f1:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c01079f8:	00 
c01079f9:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107a00:	00 
c0107a01:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107a04:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107a08:	89 04 24             	mov    %eax,(%esp)
c0107a0b:	e8 03 fd ff ff       	call   c0107713 <page_insert>
c0107a10:	85 c0                	test   %eax,%eax
c0107a12:	74 24                	je     c0107a38 <check_pgdir+0x115>
c0107a14:	c7 44 24 0c d0 ba 10 	movl   $0xc010bad0,0xc(%esp)
c0107a1b:	c0 
c0107a1c:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107a23:	c0 
c0107a24:	c7 44 24 04 11 02 00 	movl   $0x211,0x4(%esp)
c0107a2b:	00 
c0107a2c:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107a33:	e8 05 8a ff ff       	call   c010043d <__panic>

    pte_t *ptep;
    assert((ptep = get_pte(boot_pgdir, 0x0, 0)) != NULL);
c0107a38:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107a3d:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107a44:	00 
c0107a45:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0107a4c:	00 
c0107a4d:	89 04 24             	mov    %eax,(%esp)
c0107a50:	e8 79 fa ff ff       	call   c01074ce <get_pte>
c0107a55:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107a58:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107a5c:	75 24                	jne    c0107a82 <check_pgdir+0x15f>
c0107a5e:	c7 44 24 0c fc ba 10 	movl   $0xc010bafc,0xc(%esp)
c0107a65:	c0 
c0107a66:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107a6d:	c0 
c0107a6e:	c7 44 24 04 14 02 00 	movl   $0x214,0x4(%esp)
c0107a75:	00 
c0107a76:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107a7d:	e8 bb 89 ff ff       	call   c010043d <__panic>
    assert(pte2page(*ptep) == p1);
c0107a82:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107a85:	8b 00                	mov    (%eax),%eax
c0107a87:	89 04 24             	mov    %eax,(%esp)
c0107a8a:	e8 03 f1 ff ff       	call   c0106b92 <pte2page>
c0107a8f:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0107a92:	74 24                	je     c0107ab8 <check_pgdir+0x195>
c0107a94:	c7 44 24 0c 29 bb 10 	movl   $0xc010bb29,0xc(%esp)
c0107a9b:	c0 
c0107a9c:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107aa3:	c0 
c0107aa4:	c7 44 24 04 15 02 00 	movl   $0x215,0x4(%esp)
c0107aab:	00 
c0107aac:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107ab3:	e8 85 89 ff ff       	call   c010043d <__panic>
    assert(page_ref(p1) == 1);
c0107ab8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107abb:	89 04 24             	mov    %eax,(%esp)
c0107abe:	e8 25 f1 ff ff       	call   c0106be8 <page_ref>
c0107ac3:	83 f8 01             	cmp    $0x1,%eax
c0107ac6:	74 24                	je     c0107aec <check_pgdir+0x1c9>
c0107ac8:	c7 44 24 0c 3f bb 10 	movl   $0xc010bb3f,0xc(%esp)
c0107acf:	c0 
c0107ad0:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107ad7:	c0 
c0107ad8:	c7 44 24 04 16 02 00 	movl   $0x216,0x4(%esp)
c0107adf:	00 
c0107ae0:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107ae7:	e8 51 89 ff ff       	call   c010043d <__panic>

    ptep = &((pte_t *)KADDR(PDE_ADDR(boot_pgdir[0])))[1];
c0107aec:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107af1:	8b 00                	mov    (%eax),%eax
c0107af3:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c0107af8:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0107afb:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107afe:	c1 e8 0c             	shr    $0xc,%eax
c0107b01:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0107b04:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0107b09:	39 45 e8             	cmp    %eax,-0x18(%ebp)
c0107b0c:	72 23                	jb     c0107b31 <check_pgdir+0x20e>
c0107b0e:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107b11:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107b15:	c7 44 24 08 f8 b8 10 	movl   $0xc010b8f8,0x8(%esp)
c0107b1c:	c0 
c0107b1d:	c7 44 24 04 18 02 00 	movl   $0x218,0x4(%esp)
c0107b24:	00 
c0107b25:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107b2c:	e8 0c 89 ff ff       	call   c010043d <__panic>
c0107b31:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0107b34:	2d 00 00 00 40       	sub    $0x40000000,%eax
c0107b39:	83 c0 04             	add    $0x4,%eax
c0107b3c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    assert(get_pte(boot_pgdir, PGSIZE, 0) == ptep);
c0107b3f:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107b44:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107b4b:	00 
c0107b4c:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0107b53:	00 
c0107b54:	89 04 24             	mov    %eax,(%esp)
c0107b57:	e8 72 f9 ff ff       	call   c01074ce <get_pte>
c0107b5c:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0107b5f:	74 24                	je     c0107b85 <check_pgdir+0x262>
c0107b61:	c7 44 24 0c 54 bb 10 	movl   $0xc010bb54,0xc(%esp)
c0107b68:	c0 
c0107b69:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107b70:	c0 
c0107b71:	c7 44 24 04 19 02 00 	movl   $0x219,0x4(%esp)
c0107b78:	00 
c0107b79:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107b80:	e8 b8 88 ff ff       	call   c010043d <__panic>

    p2 = alloc_page();
c0107b85:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0107b8c:	e8 6d f2 ff ff       	call   c0106dfe <alloc_pages>
c0107b91:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    assert(page_insert(boot_pgdir, p2, PGSIZE, PTE_U | PTE_W) == 0);
c0107b94:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107b99:	c7 44 24 0c 06 00 00 	movl   $0x6,0xc(%esp)
c0107ba0:	00 
c0107ba1:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0107ba8:	00 
c0107ba9:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0107bac:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107bb0:	89 04 24             	mov    %eax,(%esp)
c0107bb3:	e8 5b fb ff ff       	call   c0107713 <page_insert>
c0107bb8:	85 c0                	test   %eax,%eax
c0107bba:	74 24                	je     c0107be0 <check_pgdir+0x2bd>
c0107bbc:	c7 44 24 0c 7c bb 10 	movl   $0xc010bb7c,0xc(%esp)
c0107bc3:	c0 
c0107bc4:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107bcb:	c0 
c0107bcc:	c7 44 24 04 1c 02 00 	movl   $0x21c,0x4(%esp)
c0107bd3:	00 
c0107bd4:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107bdb:	e8 5d 88 ff ff       	call   c010043d <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c0107be0:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107be5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107bec:	00 
c0107bed:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0107bf4:	00 
c0107bf5:	89 04 24             	mov    %eax,(%esp)
c0107bf8:	e8 d1 f8 ff ff       	call   c01074ce <get_pte>
c0107bfd:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107c00:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107c04:	75 24                	jne    c0107c2a <check_pgdir+0x307>
c0107c06:	c7 44 24 0c b4 bb 10 	movl   $0xc010bbb4,0xc(%esp)
c0107c0d:	c0 
c0107c0e:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107c15:	c0 
c0107c16:	c7 44 24 04 1d 02 00 	movl   $0x21d,0x4(%esp)
c0107c1d:	00 
c0107c1e:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107c25:	e8 13 88 ff ff       	call   c010043d <__panic>
    assert(*ptep & PTE_U);
c0107c2a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107c2d:	8b 00                	mov    (%eax),%eax
c0107c2f:	83 e0 04             	and    $0x4,%eax
c0107c32:	85 c0                	test   %eax,%eax
c0107c34:	75 24                	jne    c0107c5a <check_pgdir+0x337>
c0107c36:	c7 44 24 0c e4 bb 10 	movl   $0xc010bbe4,0xc(%esp)
c0107c3d:	c0 
c0107c3e:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107c45:	c0 
c0107c46:	c7 44 24 04 1e 02 00 	movl   $0x21e,0x4(%esp)
c0107c4d:	00 
c0107c4e:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107c55:	e8 e3 87 ff ff       	call   c010043d <__panic>
    assert(*ptep & PTE_W);
c0107c5a:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107c5d:	8b 00                	mov    (%eax),%eax
c0107c5f:	83 e0 02             	and    $0x2,%eax
c0107c62:	85 c0                	test   %eax,%eax
c0107c64:	75 24                	jne    c0107c8a <check_pgdir+0x367>
c0107c66:	c7 44 24 0c f2 bb 10 	movl   $0xc010bbf2,0xc(%esp)
c0107c6d:	c0 
c0107c6e:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107c75:	c0 
c0107c76:	c7 44 24 04 1f 02 00 	movl   $0x21f,0x4(%esp)
c0107c7d:	00 
c0107c7e:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107c85:	e8 b3 87 ff ff       	call   c010043d <__panic>
    assert(boot_pgdir[0] & PTE_U);
c0107c8a:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107c8f:	8b 00                	mov    (%eax),%eax
c0107c91:	83 e0 04             	and    $0x4,%eax
c0107c94:	85 c0                	test   %eax,%eax
c0107c96:	75 24                	jne    c0107cbc <check_pgdir+0x399>
c0107c98:	c7 44 24 0c 00 bc 10 	movl   $0xc010bc00,0xc(%esp)
c0107c9f:	c0 
c0107ca0:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107ca7:	c0 
c0107ca8:	c7 44 24 04 20 02 00 	movl   $0x220,0x4(%esp)
c0107caf:	00 
c0107cb0:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107cb7:	e8 81 87 ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 1);
c0107cbc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107cbf:	89 04 24             	mov    %eax,(%esp)
c0107cc2:	e8 21 ef ff ff       	call   c0106be8 <page_ref>
c0107cc7:	83 f8 01             	cmp    $0x1,%eax
c0107cca:	74 24                	je     c0107cf0 <check_pgdir+0x3cd>
c0107ccc:	c7 44 24 0c 16 bc 10 	movl   $0xc010bc16,0xc(%esp)
c0107cd3:	c0 
c0107cd4:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107cdb:	c0 
c0107cdc:	c7 44 24 04 21 02 00 	movl   $0x221,0x4(%esp)
c0107ce3:	00 
c0107ce4:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107ceb:	e8 4d 87 ff ff       	call   c010043d <__panic>

    assert(page_insert(boot_pgdir, p1, PGSIZE, 0) == 0);
c0107cf0:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107cf5:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
c0107cfc:	00 
c0107cfd:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
c0107d04:	00 
c0107d05:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0107d08:	89 54 24 04          	mov    %edx,0x4(%esp)
c0107d0c:	89 04 24             	mov    %eax,(%esp)
c0107d0f:	e8 ff f9 ff ff       	call   c0107713 <page_insert>
c0107d14:	85 c0                	test   %eax,%eax
c0107d16:	74 24                	je     c0107d3c <check_pgdir+0x419>
c0107d18:	c7 44 24 0c 28 bc 10 	movl   $0xc010bc28,0xc(%esp)
c0107d1f:	c0 
c0107d20:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107d27:	c0 
c0107d28:	c7 44 24 04 23 02 00 	movl   $0x223,0x4(%esp)
c0107d2f:	00 
c0107d30:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107d37:	e8 01 87 ff ff       	call   c010043d <__panic>
    assert(page_ref(p1) == 2);
c0107d3c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107d3f:	89 04 24             	mov    %eax,(%esp)
c0107d42:	e8 a1 ee ff ff       	call   c0106be8 <page_ref>
c0107d47:	83 f8 02             	cmp    $0x2,%eax
c0107d4a:	74 24                	je     c0107d70 <check_pgdir+0x44d>
c0107d4c:	c7 44 24 0c 54 bc 10 	movl   $0xc010bc54,0xc(%esp)
c0107d53:	c0 
c0107d54:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107d5b:	c0 
c0107d5c:	c7 44 24 04 24 02 00 	movl   $0x224,0x4(%esp)
c0107d63:	00 
c0107d64:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107d6b:	e8 cd 86 ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c0107d70:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107d73:	89 04 24             	mov    %eax,(%esp)
c0107d76:	e8 6d ee ff ff       	call   c0106be8 <page_ref>
c0107d7b:	85 c0                	test   %eax,%eax
c0107d7d:	74 24                	je     c0107da3 <check_pgdir+0x480>
c0107d7f:	c7 44 24 0c 66 bc 10 	movl   $0xc010bc66,0xc(%esp)
c0107d86:	c0 
c0107d87:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107d8e:	c0 
c0107d8f:	c7 44 24 04 25 02 00 	movl   $0x225,0x4(%esp)
c0107d96:	00 
c0107d97:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107d9e:	e8 9a 86 ff ff       	call   c010043d <__panic>
    assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL);
c0107da3:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107da8:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c0107daf:	00 
c0107db0:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0107db7:	00 
c0107db8:	89 04 24             	mov    %eax,(%esp)
c0107dbb:	e8 0e f7 ff ff       	call   c01074ce <get_pte>
c0107dc0:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0107dc3:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0107dc7:	75 24                	jne    c0107ded <check_pgdir+0x4ca>
c0107dc9:	c7 44 24 0c b4 bb 10 	movl   $0xc010bbb4,0xc(%esp)
c0107dd0:	c0 
c0107dd1:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107dd8:	c0 
c0107dd9:	c7 44 24 04 26 02 00 	movl   $0x226,0x4(%esp)
c0107de0:	00 
c0107de1:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107de8:	e8 50 86 ff ff       	call   c010043d <__panic>
    assert(pte2page(*ptep) == p1);
c0107ded:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107df0:	8b 00                	mov    (%eax),%eax
c0107df2:	89 04 24             	mov    %eax,(%esp)
c0107df5:	e8 98 ed ff ff       	call   c0106b92 <pte2page>
c0107dfa:	39 45 f4             	cmp    %eax,-0xc(%ebp)
c0107dfd:	74 24                	je     c0107e23 <check_pgdir+0x500>
c0107dff:	c7 44 24 0c 29 bb 10 	movl   $0xc010bb29,0xc(%esp)
c0107e06:	c0 
c0107e07:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107e0e:	c0 
c0107e0f:	c7 44 24 04 27 02 00 	movl   $0x227,0x4(%esp)
c0107e16:	00 
c0107e17:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107e1e:	e8 1a 86 ff ff       	call   c010043d <__panic>
    assert((*ptep & PTE_U) == 0);
c0107e23:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0107e26:	8b 00                	mov    (%eax),%eax
c0107e28:	83 e0 04             	and    $0x4,%eax
c0107e2b:	85 c0                	test   %eax,%eax
c0107e2d:	74 24                	je     c0107e53 <check_pgdir+0x530>
c0107e2f:	c7 44 24 0c 78 bc 10 	movl   $0xc010bc78,0xc(%esp)
c0107e36:	c0 
c0107e37:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107e3e:	c0 
c0107e3f:	c7 44 24 04 28 02 00 	movl   $0x228,0x4(%esp)
c0107e46:	00 
c0107e47:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107e4e:	e8 ea 85 ff ff       	call   c010043d <__panic>

    page_remove(boot_pgdir, 0x0);
c0107e53:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107e58:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0107e5f:	00 
c0107e60:	89 04 24             	mov    %eax,(%esp)
c0107e63:	e8 62 f8 ff ff       	call   c01076ca <page_remove>
    assert(page_ref(p1) == 1);
c0107e68:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107e6b:	89 04 24             	mov    %eax,(%esp)
c0107e6e:	e8 75 ed ff ff       	call   c0106be8 <page_ref>
c0107e73:	83 f8 01             	cmp    $0x1,%eax
c0107e76:	74 24                	je     c0107e9c <check_pgdir+0x579>
c0107e78:	c7 44 24 0c 3f bb 10 	movl   $0xc010bb3f,0xc(%esp)
c0107e7f:	c0 
c0107e80:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107e87:	c0 
c0107e88:	c7 44 24 04 2b 02 00 	movl   $0x22b,0x4(%esp)
c0107e8f:	00 
c0107e90:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107e97:	e8 a1 85 ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c0107e9c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107e9f:	89 04 24             	mov    %eax,(%esp)
c0107ea2:	e8 41 ed ff ff       	call   c0106be8 <page_ref>
c0107ea7:	85 c0                	test   %eax,%eax
c0107ea9:	74 24                	je     c0107ecf <check_pgdir+0x5ac>
c0107eab:	c7 44 24 0c 66 bc 10 	movl   $0xc010bc66,0xc(%esp)
c0107eb2:	c0 
c0107eb3:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107eba:	c0 
c0107ebb:	c7 44 24 04 2c 02 00 	movl   $0x22c,0x4(%esp)
c0107ec2:	00 
c0107ec3:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107eca:	e8 6e 85 ff ff       	call   c010043d <__panic>

    page_remove(boot_pgdir, PGSIZE);
c0107ecf:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107ed4:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
c0107edb:	00 
c0107edc:	89 04 24             	mov    %eax,(%esp)
c0107edf:	e8 e6 f7 ff ff       	call   c01076ca <page_remove>
    assert(page_ref(p1) == 0);
c0107ee4:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107ee7:	89 04 24             	mov    %eax,(%esp)
c0107eea:	e8 f9 ec ff ff       	call   c0106be8 <page_ref>
c0107eef:	85 c0                	test   %eax,%eax
c0107ef1:	74 24                	je     c0107f17 <check_pgdir+0x5f4>
c0107ef3:	c7 44 24 0c 8d bc 10 	movl   $0xc010bc8d,0xc(%esp)
c0107efa:	c0 
c0107efb:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107f02:	c0 
c0107f03:	c7 44 24 04 2f 02 00 	movl   $0x22f,0x4(%esp)
c0107f0a:	00 
c0107f0b:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107f12:	e8 26 85 ff ff       	call   c010043d <__panic>
    assert(page_ref(p2) == 0);
c0107f17:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107f1a:	89 04 24             	mov    %eax,(%esp)
c0107f1d:	e8 c6 ec ff ff       	call   c0106be8 <page_ref>
c0107f22:	85 c0                	test   %eax,%eax
c0107f24:	74 24                	je     c0107f4a <check_pgdir+0x627>
c0107f26:	c7 44 24 0c 66 bc 10 	movl   $0xc010bc66,0xc(%esp)
c0107f2d:	c0 
c0107f2e:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107f35:	c0 
c0107f36:	c7 44 24 04 30 02 00 	movl   $0x230,0x4(%esp)
c0107f3d:	00 
c0107f3e:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107f45:	e8 f3 84 ff ff       	call   c010043d <__panic>

    assert(page_ref(pde2page(boot_pgdir[0])) == 1);
c0107f4a:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107f4f:	8b 00                	mov    (%eax),%eax
c0107f51:	89 04 24             	mov    %eax,(%esp)
c0107f54:	e8 77 ec ff ff       	call   c0106bd0 <pde2page>
c0107f59:	89 04 24             	mov    %eax,(%esp)
c0107f5c:	e8 87 ec ff ff       	call   c0106be8 <page_ref>
c0107f61:	83 f8 01             	cmp    $0x1,%eax
c0107f64:	74 24                	je     c0107f8a <check_pgdir+0x667>
c0107f66:	c7 44 24 0c a0 bc 10 	movl   $0xc010bca0,0xc(%esp)
c0107f6d:	c0 
c0107f6e:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0107f75:	c0 
c0107f76:	c7 44 24 04 32 02 00 	movl   $0x232,0x4(%esp)
c0107f7d:	00 
c0107f7e:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0107f85:	e8 b3 84 ff ff       	call   c010043d <__panic>
    free_page(pde2page(boot_pgdir[0]));
c0107f8a:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107f8f:	8b 00                	mov    (%eax),%eax
c0107f91:	89 04 24             	mov    %eax,(%esp)
c0107f94:	e8 37 ec ff ff       	call   c0106bd0 <pde2page>
c0107f99:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c0107fa0:	00 
c0107fa1:	89 04 24             	mov    %eax,(%esp)
c0107fa4:	e8 c4 ee ff ff       	call   c0106e6d <free_pages>
    boot_pgdir[0] = 0;
c0107fa9:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0107fae:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_pgdir() succeeded!\n");
c0107fb4:	c7 04 24 c7 bc 10 c0 	movl   $0xc010bcc7,(%esp)
c0107fbb:	e8 11 83 ff ff       	call   c01002d1 <cprintf>
}
c0107fc0:	90                   	nop
c0107fc1:	c9                   	leave  
c0107fc2:	c3                   	ret    

c0107fc3 <check_boot_pgdir>:

static void
check_boot_pgdir(void) {
c0107fc3:	f3 0f 1e fb          	endbr32 
c0107fc7:	55                   	push   %ebp
c0107fc8:	89 e5                	mov    %esp,%ebp
c0107fca:	83 ec 38             	sub    $0x38,%esp
    pte_t *ptep;
    int i;
    for (i = 0; i < npage; i += PGSIZE) {
c0107fcd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c0107fd4:	e9 ca 00 00 00       	jmp    c01080a3 <check_boot_pgdir+0xe0>
        assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
c0107fd9:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0107fdc:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0107fdf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107fe2:	c1 e8 0c             	shr    $0xc,%eax
c0107fe5:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0107fe8:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0107fed:	39 45 e0             	cmp    %eax,-0x20(%ebp)
c0107ff0:	72 23                	jb     c0108015 <check_boot_pgdir+0x52>
c0107ff2:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0107ff5:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0107ff9:	c7 44 24 08 f8 b8 10 	movl   $0xc010b8f8,0x8(%esp)
c0108000:	c0 
c0108001:	c7 44 24 04 3e 02 00 	movl   $0x23e,0x4(%esp)
c0108008:	00 
c0108009:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0108010:	e8 28 84 ff ff       	call   c010043d <__panic>
c0108015:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108018:	2d 00 00 00 40       	sub    $0x40000000,%eax
c010801d:	89 c2                	mov    %eax,%edx
c010801f:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c0108024:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c010802b:	00 
c010802c:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108030:	89 04 24             	mov    %eax,(%esp)
c0108033:	e8 96 f4 ff ff       	call   c01074ce <get_pte>
c0108038:	89 45 dc             	mov    %eax,-0x24(%ebp)
c010803b:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c010803f:	75 24                	jne    c0108065 <check_boot_pgdir+0xa2>
c0108041:	c7 44 24 0c e4 bc 10 	movl   $0xc010bce4,0xc(%esp)
c0108048:	c0 
c0108049:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0108050:	c0 
c0108051:	c7 44 24 04 3e 02 00 	movl   $0x23e,0x4(%esp)
c0108058:	00 
c0108059:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0108060:	e8 d8 83 ff ff       	call   c010043d <__panic>
        assert(PTE_ADDR(*ptep) == i);
c0108065:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108068:	8b 00                	mov    (%eax),%eax
c010806a:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c010806f:	89 c2                	mov    %eax,%edx
c0108071:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108074:	39 c2                	cmp    %eax,%edx
c0108076:	74 24                	je     c010809c <check_boot_pgdir+0xd9>
c0108078:	c7 44 24 0c 21 bd 10 	movl   $0xc010bd21,0xc(%esp)
c010807f:	c0 
c0108080:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0108087:	c0 
c0108088:	c7 44 24 04 3f 02 00 	movl   $0x23f,0x4(%esp)
c010808f:	00 
c0108090:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0108097:	e8 a1 83 ff ff       	call   c010043d <__panic>
    for (i = 0; i < npage; i += PGSIZE) {
c010809c:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
c01080a3:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01080a6:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c01080ab:	39 c2                	cmp    %eax,%edx
c01080ad:	0f 82 26 ff ff ff    	jb     c0107fd9 <check_boot_pgdir+0x16>
    }

    assert(PDE_ADDR(boot_pgdir[PDX(VPT)]) == PADDR(boot_pgdir));
c01080b3:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c01080b8:	05 ac 0f 00 00       	add    $0xfac,%eax
c01080bd:	8b 00                	mov    (%eax),%eax
c01080bf:	25 00 f0 ff ff       	and    $0xfffff000,%eax
c01080c4:	89 c2                	mov    %eax,%edx
c01080c6:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c01080cb:	89 45 f0             	mov    %eax,-0x10(%ebp)
c01080ce:	81 7d f0 ff ff ff bf 	cmpl   $0xbfffffff,-0x10(%ebp)
c01080d5:	77 23                	ja     c01080fa <check_boot_pgdir+0x137>
c01080d7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01080da:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01080de:	c7 44 24 08 9c b9 10 	movl   $0xc010b99c,0x8(%esp)
c01080e5:	c0 
c01080e6:	c7 44 24 04 42 02 00 	movl   $0x242,0x4(%esp)
c01080ed:	00 
c01080ee:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01080f5:	e8 43 83 ff ff       	call   c010043d <__panic>
c01080fa:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01080fd:	05 00 00 00 40       	add    $0x40000000,%eax
c0108102:	39 d0                	cmp    %edx,%eax
c0108104:	74 24                	je     c010812a <check_boot_pgdir+0x167>
c0108106:	c7 44 24 0c 38 bd 10 	movl   $0xc010bd38,0xc(%esp)
c010810d:	c0 
c010810e:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0108115:	c0 
c0108116:	c7 44 24 04 42 02 00 	movl   $0x242,0x4(%esp)
c010811d:	00 
c010811e:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0108125:	e8 13 83 ff ff       	call   c010043d <__panic>

    assert(boot_pgdir[0] == 0);
c010812a:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c010812f:	8b 00                	mov    (%eax),%eax
c0108131:	85 c0                	test   %eax,%eax
c0108133:	74 24                	je     c0108159 <check_boot_pgdir+0x196>
c0108135:	c7 44 24 0c 6c bd 10 	movl   $0xc010bd6c,0xc(%esp)
c010813c:	c0 
c010813d:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0108144:	c0 
c0108145:	c7 44 24 04 44 02 00 	movl   $0x244,0x4(%esp)
c010814c:	00 
c010814d:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0108154:	e8 e4 82 ff ff       	call   c010043d <__panic>

    struct Page *p;
    p = alloc_page();
c0108159:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108160:	e8 99 ec ff ff       	call   c0106dfe <alloc_pages>
c0108165:	89 45 ec             	mov    %eax,-0x14(%ebp)
    assert(page_insert(boot_pgdir, p, 0x100, PTE_W) == 0);
c0108168:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c010816d:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c0108174:	00 
c0108175:	c7 44 24 08 00 01 00 	movl   $0x100,0x8(%esp)
c010817c:	00 
c010817d:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0108180:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108184:	89 04 24             	mov    %eax,(%esp)
c0108187:	e8 87 f5 ff ff       	call   c0107713 <page_insert>
c010818c:	85 c0                	test   %eax,%eax
c010818e:	74 24                	je     c01081b4 <check_boot_pgdir+0x1f1>
c0108190:	c7 44 24 0c 80 bd 10 	movl   $0xc010bd80,0xc(%esp)
c0108197:	c0 
c0108198:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c010819f:	c0 
c01081a0:	c7 44 24 04 48 02 00 	movl   $0x248,0x4(%esp)
c01081a7:	00 
c01081a8:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01081af:	e8 89 82 ff ff       	call   c010043d <__panic>
    assert(page_ref(p) == 1);
c01081b4:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01081b7:	89 04 24             	mov    %eax,(%esp)
c01081ba:	e8 29 ea ff ff       	call   c0106be8 <page_ref>
c01081bf:	83 f8 01             	cmp    $0x1,%eax
c01081c2:	74 24                	je     c01081e8 <check_boot_pgdir+0x225>
c01081c4:	c7 44 24 0c ae bd 10 	movl   $0xc010bdae,0xc(%esp)
c01081cb:	c0 
c01081cc:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c01081d3:	c0 
c01081d4:	c7 44 24 04 49 02 00 	movl   $0x249,0x4(%esp)
c01081db:	00 
c01081dc:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01081e3:	e8 55 82 ff ff       	call   c010043d <__panic>
    assert(page_insert(boot_pgdir, p, 0x100 + PGSIZE, PTE_W) == 0);
c01081e8:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c01081ed:	c7 44 24 0c 02 00 00 	movl   $0x2,0xc(%esp)
c01081f4:	00 
c01081f5:	c7 44 24 08 00 11 00 	movl   $0x1100,0x8(%esp)
c01081fc:	00 
c01081fd:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0108200:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108204:	89 04 24             	mov    %eax,(%esp)
c0108207:	e8 07 f5 ff ff       	call   c0107713 <page_insert>
c010820c:	85 c0                	test   %eax,%eax
c010820e:	74 24                	je     c0108234 <check_boot_pgdir+0x271>
c0108210:	c7 44 24 0c c0 bd 10 	movl   $0xc010bdc0,0xc(%esp)
c0108217:	c0 
c0108218:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c010821f:	c0 
c0108220:	c7 44 24 04 4a 02 00 	movl   $0x24a,0x4(%esp)
c0108227:	00 
c0108228:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c010822f:	e8 09 82 ff ff       	call   c010043d <__panic>
    assert(page_ref(p) == 2);
c0108234:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108237:	89 04 24             	mov    %eax,(%esp)
c010823a:	e8 a9 e9 ff ff       	call   c0106be8 <page_ref>
c010823f:	83 f8 02             	cmp    $0x2,%eax
c0108242:	74 24                	je     c0108268 <check_boot_pgdir+0x2a5>
c0108244:	c7 44 24 0c f7 bd 10 	movl   $0xc010bdf7,0xc(%esp)
c010824b:	c0 
c010824c:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c0108253:	c0 
c0108254:	c7 44 24 04 4b 02 00 	movl   $0x24b,0x4(%esp)
c010825b:	00 
c010825c:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0108263:	e8 d5 81 ff ff       	call   c010043d <__panic>

    const char *str = "ucore: Hello world!!";
c0108268:	c7 45 e8 08 be 10 c0 	movl   $0xc010be08,-0x18(%ebp)
    strcpy((void *)0x100, str);
c010826f:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108272:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108276:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c010827d:	e8 d8 11 00 00       	call   c010945a <strcpy>
    assert(strcmp((void *)0x100, (void *)(0x100 + PGSIZE)) == 0);
c0108282:	c7 44 24 04 00 11 00 	movl   $0x1100,0x4(%esp)
c0108289:	00 
c010828a:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c0108291:	e8 42 12 00 00       	call   c01094d8 <strcmp>
c0108296:	85 c0                	test   %eax,%eax
c0108298:	74 24                	je     c01082be <check_boot_pgdir+0x2fb>
c010829a:	c7 44 24 0c 20 be 10 	movl   $0xc010be20,0xc(%esp)
c01082a1:	c0 
c01082a2:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c01082a9:	c0 
c01082aa:	c7 44 24 04 4f 02 00 	movl   $0x24f,0x4(%esp)
c01082b1:	00 
c01082b2:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c01082b9:	e8 7f 81 ff ff       	call   c010043d <__panic>

    *(char *)(page2kva(p) + 0x100) = '\0';
c01082be:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01082c1:	89 04 24             	mov    %eax,(%esp)
c01082c4:	e8 75 e8 ff ff       	call   c0106b3e <page2kva>
c01082c9:	05 00 01 00 00       	add    $0x100,%eax
c01082ce:	c6 00 00             	movb   $0x0,(%eax)
    assert(strlen((const char *)0x100) == 0);
c01082d1:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
c01082d8:	e8 1f 11 00 00       	call   c01093fc <strlen>
c01082dd:	85 c0                	test   %eax,%eax
c01082df:	74 24                	je     c0108305 <check_boot_pgdir+0x342>
c01082e1:	c7 44 24 0c 58 be 10 	movl   $0xc010be58,0xc(%esp)
c01082e8:	c0 
c01082e9:	c7 44 24 08 e5 b9 10 	movl   $0xc010b9e5,0x8(%esp)
c01082f0:	c0 
c01082f1:	c7 44 24 04 52 02 00 	movl   $0x252,0x4(%esp)
c01082f8:	00 
c01082f9:	c7 04 24 c0 b9 10 c0 	movl   $0xc010b9c0,(%esp)
c0108300:	e8 38 81 ff ff       	call   c010043d <__panic>

    free_page(p);
c0108305:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010830c:	00 
c010830d:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108310:	89 04 24             	mov    %eax,(%esp)
c0108313:	e8 55 eb ff ff       	call   c0106e6d <free_pages>
    free_page(pde2page(boot_pgdir[0]));
c0108318:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c010831d:	8b 00                	mov    (%eax),%eax
c010831f:	89 04 24             	mov    %eax,(%esp)
c0108322:	e8 a9 e8 ff ff       	call   c0106bd0 <pde2page>
c0108327:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
c010832e:	00 
c010832f:	89 04 24             	mov    %eax,(%esp)
c0108332:	e8 36 eb ff ff       	call   c0106e6d <free_pages>
    boot_pgdir[0] = 0;
c0108337:	a1 20 8a 12 c0       	mov    0xc0128a20,%eax
c010833c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

    cprintf("check_boot_pgdir() succeeded!\n");
c0108342:	c7 04 24 7c be 10 c0 	movl   $0xc010be7c,(%esp)
c0108349:	e8 83 7f ff ff       	call   c01002d1 <cprintf>
}
c010834e:	90                   	nop
c010834f:	c9                   	leave  
c0108350:	c3                   	ret    

c0108351 <perm2str>:

//perm2str - use string 'u,r,w,-' to present the permission
static const char *
perm2str(int perm) {
c0108351:	f3 0f 1e fb          	endbr32 
c0108355:	55                   	push   %ebp
c0108356:	89 e5                	mov    %esp,%ebp
    static char str[4];
    str[0] = (perm & PTE_U) ? 'u' : '-';
c0108358:	8b 45 08             	mov    0x8(%ebp),%eax
c010835b:	83 e0 04             	and    $0x4,%eax
c010835e:	85 c0                	test   %eax,%eax
c0108360:	74 04                	je     c0108366 <perm2str+0x15>
c0108362:	b0 75                	mov    $0x75,%al
c0108364:	eb 02                	jmp    c0108368 <perm2str+0x17>
c0108366:	b0 2d                	mov    $0x2d,%al
c0108368:	a2 08 c0 12 c0       	mov    %al,0xc012c008
    str[1] = 'r';
c010836d:	c6 05 09 c0 12 c0 72 	movb   $0x72,0xc012c009
    str[2] = (perm & PTE_W) ? 'w' : '-';
c0108374:	8b 45 08             	mov    0x8(%ebp),%eax
c0108377:	83 e0 02             	and    $0x2,%eax
c010837a:	85 c0                	test   %eax,%eax
c010837c:	74 04                	je     c0108382 <perm2str+0x31>
c010837e:	b0 77                	mov    $0x77,%al
c0108380:	eb 02                	jmp    c0108384 <perm2str+0x33>
c0108382:	b0 2d                	mov    $0x2d,%al
c0108384:	a2 0a c0 12 c0       	mov    %al,0xc012c00a
    str[3] = '\0';
c0108389:	c6 05 0b c0 12 c0 00 	movb   $0x0,0xc012c00b
    return str;
c0108390:	b8 08 c0 12 c0       	mov    $0xc012c008,%eax
}
c0108395:	5d                   	pop    %ebp
c0108396:	c3                   	ret    

c0108397 <get_pgtable_items>:
//  table:       the beginning addr of table
//  left_store:  the pointer of the high side of table's next range
//  right_store: the pointer of the low side of table's next range
// return value: 0 - not a invalid item range, perm - a valid item range with perm permission 
static int
get_pgtable_items(size_t left, size_t right, size_t start, uintptr_t *table, size_t *left_store, size_t *right_store) {
c0108397:	f3 0f 1e fb          	endbr32 
c010839b:	55                   	push   %ebp
c010839c:	89 e5                	mov    %esp,%ebp
c010839e:	83 ec 10             	sub    $0x10,%esp
    if (start >= right) {
c01083a1:	8b 45 10             	mov    0x10(%ebp),%eax
c01083a4:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01083a7:	72 0d                	jb     c01083b6 <get_pgtable_items+0x1f>
        return 0;
c01083a9:	b8 00 00 00 00       	mov    $0x0,%eax
c01083ae:	e9 98 00 00 00       	jmp    c010844b <get_pgtable_items+0xb4>
    }
    while (start < right && !(table[start] & PTE_P)) {
        start ++;
c01083b3:	ff 45 10             	incl   0x10(%ebp)
    while (start < right && !(table[start] & PTE_P)) {
c01083b6:	8b 45 10             	mov    0x10(%ebp),%eax
c01083b9:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01083bc:	73 18                	jae    c01083d6 <get_pgtable_items+0x3f>
c01083be:	8b 45 10             	mov    0x10(%ebp),%eax
c01083c1:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01083c8:	8b 45 14             	mov    0x14(%ebp),%eax
c01083cb:	01 d0                	add    %edx,%eax
c01083cd:	8b 00                	mov    (%eax),%eax
c01083cf:	83 e0 01             	and    $0x1,%eax
c01083d2:	85 c0                	test   %eax,%eax
c01083d4:	74 dd                	je     c01083b3 <get_pgtable_items+0x1c>
    }
    if (start < right) {
c01083d6:	8b 45 10             	mov    0x10(%ebp),%eax
c01083d9:	3b 45 0c             	cmp    0xc(%ebp),%eax
c01083dc:	73 68                	jae    c0108446 <get_pgtable_items+0xaf>
        if (left_store != NULL) {
c01083de:	83 7d 18 00          	cmpl   $0x0,0x18(%ebp)
c01083e2:	74 08                	je     c01083ec <get_pgtable_items+0x55>
            *left_store = start;
c01083e4:	8b 45 18             	mov    0x18(%ebp),%eax
c01083e7:	8b 55 10             	mov    0x10(%ebp),%edx
c01083ea:	89 10                	mov    %edx,(%eax)
        }
        int perm = (table[start ++] & PTE_USER);
c01083ec:	8b 45 10             	mov    0x10(%ebp),%eax
c01083ef:	8d 50 01             	lea    0x1(%eax),%edx
c01083f2:	89 55 10             	mov    %edx,0x10(%ebp)
c01083f5:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c01083fc:	8b 45 14             	mov    0x14(%ebp),%eax
c01083ff:	01 d0                	add    %edx,%eax
c0108401:	8b 00                	mov    (%eax),%eax
c0108403:	83 e0 07             	and    $0x7,%eax
c0108406:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c0108409:	eb 03                	jmp    c010840e <get_pgtable_items+0x77>
            start ++;
c010840b:	ff 45 10             	incl   0x10(%ebp)
        while (start < right && (table[start] & PTE_USER) == perm) {
c010840e:	8b 45 10             	mov    0x10(%ebp),%eax
c0108411:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0108414:	73 1d                	jae    c0108433 <get_pgtable_items+0x9c>
c0108416:	8b 45 10             	mov    0x10(%ebp),%eax
c0108419:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
c0108420:	8b 45 14             	mov    0x14(%ebp),%eax
c0108423:	01 d0                	add    %edx,%eax
c0108425:	8b 00                	mov    (%eax),%eax
c0108427:	83 e0 07             	and    $0x7,%eax
c010842a:	89 c2                	mov    %eax,%edx
c010842c:	8b 45 fc             	mov    -0x4(%ebp),%eax
c010842f:	39 c2                	cmp    %eax,%edx
c0108431:	74 d8                	je     c010840b <get_pgtable_items+0x74>
        }
        if (right_store != NULL) {
c0108433:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c0108437:	74 08                	je     c0108441 <get_pgtable_items+0xaa>
            *right_store = start;
c0108439:	8b 45 1c             	mov    0x1c(%ebp),%eax
c010843c:	8b 55 10             	mov    0x10(%ebp),%edx
c010843f:	89 10                	mov    %edx,(%eax)
        }
        return perm;
c0108441:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108444:	eb 05                	jmp    c010844b <get_pgtable_items+0xb4>
    }
    return 0;
c0108446:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010844b:	c9                   	leave  
c010844c:	c3                   	ret    

c010844d <print_pgdir>:

//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
c010844d:	f3 0f 1e fb          	endbr32 
c0108451:	55                   	push   %ebp
c0108452:	89 e5                	mov    %esp,%ebp
c0108454:	57                   	push   %edi
c0108455:	56                   	push   %esi
c0108456:	53                   	push   %ebx
c0108457:	83 ec 4c             	sub    $0x4c,%esp
    cprintf("-------------------- BEGIN --------------------\n");
c010845a:	c7 04 24 9c be 10 c0 	movl   $0xc010be9c,(%esp)
c0108461:	e8 6b 7e ff ff       	call   c01002d1 <cprintf>
    size_t left, right = 0, perm;
c0108466:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c010846d:	e9 fa 00 00 00       	jmp    c010856c <print_pgdir+0x11f>
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0108472:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108475:	89 04 24             	mov    %eax,(%esp)
c0108478:	e8 d4 fe ff ff       	call   c0108351 <perm2str>
                left * PTSIZE, right * PTSIZE, (right - left) * PTSIZE, perm2str(perm));
c010847d:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c0108480:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108483:	29 d1                	sub    %edx,%ecx
c0108485:	89 ca                	mov    %ecx,%edx
        cprintf("PDE(%03x) %08x-%08x %08x %s\n", right - left,
c0108487:	89 d6                	mov    %edx,%esi
c0108489:	c1 e6 16             	shl    $0x16,%esi
c010848c:	8b 55 dc             	mov    -0x24(%ebp),%edx
c010848f:	89 d3                	mov    %edx,%ebx
c0108491:	c1 e3 16             	shl    $0x16,%ebx
c0108494:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108497:	89 d1                	mov    %edx,%ecx
c0108499:	c1 e1 16             	shl    $0x16,%ecx
c010849c:	8b 7d dc             	mov    -0x24(%ebp),%edi
c010849f:	8b 55 e0             	mov    -0x20(%ebp),%edx
c01084a2:	29 d7                	sub    %edx,%edi
c01084a4:	89 fa                	mov    %edi,%edx
c01084a6:	89 44 24 14          	mov    %eax,0x14(%esp)
c01084aa:	89 74 24 10          	mov    %esi,0x10(%esp)
c01084ae:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c01084b2:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c01084b6:	89 54 24 04          	mov    %edx,0x4(%esp)
c01084ba:	c7 04 24 cd be 10 c0 	movl   $0xc010becd,(%esp)
c01084c1:	e8 0b 7e ff ff       	call   c01002d1 <cprintf>
        size_t l, r = left * NPTEENTRY;
c01084c6:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01084c9:	c1 e0 0a             	shl    $0xa,%eax
c01084cc:	89 45 d4             	mov    %eax,-0x2c(%ebp)
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c01084cf:	eb 54                	jmp    c0108525 <print_pgdir+0xd8>
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c01084d1:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c01084d4:	89 04 24             	mov    %eax,(%esp)
c01084d7:	e8 75 fe ff ff       	call   c0108351 <perm2str>
                    l * PGSIZE, r * PGSIZE, (r - l) * PGSIZE, perm2str(perm));
c01084dc:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c01084df:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01084e2:	29 d1                	sub    %edx,%ecx
c01084e4:	89 ca                	mov    %ecx,%edx
            cprintf("  |-- PTE(%05x) %08x-%08x %08x %s\n", r - l,
c01084e6:	89 d6                	mov    %edx,%esi
c01084e8:	c1 e6 0c             	shl    $0xc,%esi
c01084eb:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01084ee:	89 d3                	mov    %edx,%ebx
c01084f0:	c1 e3 0c             	shl    $0xc,%ebx
c01084f3:	8b 55 d8             	mov    -0x28(%ebp),%edx
c01084f6:	89 d1                	mov    %edx,%ecx
c01084f8:	c1 e1 0c             	shl    $0xc,%ecx
c01084fb:	8b 7d d4             	mov    -0x2c(%ebp),%edi
c01084fe:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0108501:	29 d7                	sub    %edx,%edi
c0108503:	89 fa                	mov    %edi,%edx
c0108505:	89 44 24 14          	mov    %eax,0x14(%esp)
c0108509:	89 74 24 10          	mov    %esi,0x10(%esp)
c010850d:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c0108511:	89 4c 24 08          	mov    %ecx,0x8(%esp)
c0108515:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108519:	c7 04 24 ec be 10 c0 	movl   $0xc010beec,(%esp)
c0108520:	e8 ac 7d ff ff       	call   c01002d1 <cprintf>
        while ((perm = get_pgtable_items(left * NPTEENTRY, right * NPTEENTRY, r, vpt, &l, &r)) != 0) {
c0108525:	be 00 00 c0 fa       	mov    $0xfac00000,%esi
c010852a:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c010852d:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0108530:	89 d3                	mov    %edx,%ebx
c0108532:	c1 e3 0a             	shl    $0xa,%ebx
c0108535:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108538:	89 d1                	mov    %edx,%ecx
c010853a:	c1 e1 0a             	shl    $0xa,%ecx
c010853d:	8d 55 d4             	lea    -0x2c(%ebp),%edx
c0108540:	89 54 24 14          	mov    %edx,0x14(%esp)
c0108544:	8d 55 d8             	lea    -0x28(%ebp),%edx
c0108547:	89 54 24 10          	mov    %edx,0x10(%esp)
c010854b:	89 74 24 0c          	mov    %esi,0xc(%esp)
c010854f:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108553:	89 5c 24 04          	mov    %ebx,0x4(%esp)
c0108557:	89 0c 24             	mov    %ecx,(%esp)
c010855a:	e8 38 fe ff ff       	call   c0108397 <get_pgtable_items>
c010855f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0108562:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0108566:	0f 85 65 ff ff ff    	jne    c01084d1 <print_pgdir+0x84>
    while ((perm = get_pgtable_items(0, NPDEENTRY, right, vpd, &left, &right)) != 0) {
c010856c:	b9 00 b0 fe fa       	mov    $0xfafeb000,%ecx
c0108571:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108574:	8d 55 dc             	lea    -0x24(%ebp),%edx
c0108577:	89 54 24 14          	mov    %edx,0x14(%esp)
c010857b:	8d 55 e0             	lea    -0x20(%ebp),%edx
c010857e:	89 54 24 10          	mov    %edx,0x10(%esp)
c0108582:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
c0108586:	89 44 24 08          	mov    %eax,0x8(%esp)
c010858a:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
c0108591:	00 
c0108592:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
c0108599:	e8 f9 fd ff ff       	call   c0108397 <get_pgtable_items>
c010859e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01085a1:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c01085a5:	0f 85 c7 fe ff ff    	jne    c0108472 <print_pgdir+0x25>
        }
    }
    cprintf("--------------------- END ---------------------\n");
c01085ab:	c7 04 24 10 bf 10 c0 	movl   $0xc010bf10,(%esp)
c01085b2:	e8 1a 7d ff ff       	call   c01002d1 <cprintf>
}
c01085b7:	90                   	nop
c01085b8:	83 c4 4c             	add    $0x4c,%esp
c01085bb:	5b                   	pop    %ebx
c01085bc:	5e                   	pop    %esi
c01085bd:	5f                   	pop    %edi
c01085be:	5d                   	pop    %ebp
c01085bf:	c3                   	ret    

c01085c0 <page2ppn>:
page2ppn(struct Page *page) {
c01085c0:	55                   	push   %ebp
c01085c1:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01085c3:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c01085c8:	8b 55 08             	mov    0x8(%ebp),%edx
c01085cb:	29 c2                	sub    %eax,%edx
c01085cd:	89 d0                	mov    %edx,%eax
c01085cf:	c1 f8 05             	sar    $0x5,%eax
}
c01085d2:	5d                   	pop    %ebp
c01085d3:	c3                   	ret    

c01085d4 <page2pa>:
page2pa(struct Page *page) {
c01085d4:	55                   	push   %ebp
c01085d5:	89 e5                	mov    %esp,%ebp
c01085d7:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c01085da:	8b 45 08             	mov    0x8(%ebp),%eax
c01085dd:	89 04 24             	mov    %eax,(%esp)
c01085e0:	e8 db ff ff ff       	call   c01085c0 <page2ppn>
c01085e5:	c1 e0 0c             	shl    $0xc,%eax
}
c01085e8:	c9                   	leave  
c01085e9:	c3                   	ret    

c01085ea <page2kva>:
page2kva(struct Page *page) {
c01085ea:	55                   	push   %ebp
c01085eb:	89 e5                	mov    %esp,%ebp
c01085ed:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c01085f0:	8b 45 08             	mov    0x8(%ebp),%eax
c01085f3:	89 04 24             	mov    %eax,(%esp)
c01085f6:	e8 d9 ff ff ff       	call   c01085d4 <page2pa>
c01085fb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01085fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108601:	c1 e8 0c             	shr    $0xc,%eax
c0108604:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108607:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c010860c:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c010860f:	72 23                	jb     c0108634 <page2kva+0x4a>
c0108611:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108614:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108618:	c7 44 24 08 44 bf 10 	movl   $0xc010bf44,0x8(%esp)
c010861f:	c0 
c0108620:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c0108627:	00 
c0108628:	c7 04 24 67 bf 10 c0 	movl   $0xc010bf67,(%esp)
c010862f:	e8 09 7e ff ff       	call   c010043d <__panic>
c0108634:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108637:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c010863c:	c9                   	leave  
c010863d:	c3                   	ret    

c010863e <swapfs_init>:
#include <ide.h>
#include <pmm.h>
#include <assert.h>

void
swapfs_init(void) {
c010863e:	f3 0f 1e fb          	endbr32 
c0108642:	55                   	push   %ebp
c0108643:	89 e5                	mov    %esp,%ebp
c0108645:	83 ec 18             	sub    $0x18,%esp
    static_assert((PGSIZE % SECTSIZE) == 0);
    if (!ide_device_valid(SWAP_DEV_NO)) {
c0108648:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010864f:	e8 63 8a ff ff       	call   c01010b7 <ide_device_valid>
c0108654:	85 c0                	test   %eax,%eax
c0108656:	75 1c                	jne    c0108674 <swapfs_init+0x36>
        panic("swap fs isn't available.\n");
c0108658:	c7 44 24 08 75 bf 10 	movl   $0xc010bf75,0x8(%esp)
c010865f:	c0 
c0108660:	c7 44 24 04 0d 00 00 	movl   $0xd,0x4(%esp)
c0108667:	00 
c0108668:	c7 04 24 8f bf 10 c0 	movl   $0xc010bf8f,(%esp)
c010866f:	e8 c9 7d ff ff       	call   c010043d <__panic>
    }
    max_swap_offset = ide_device_size(SWAP_DEV_NO) / (PGSIZE / SECTSIZE);
c0108674:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c010867b:	e8 79 8a ff ff       	call   c01010f9 <ide_device_size>
c0108680:	c1 e8 03             	shr    $0x3,%eax
c0108683:	a3 fc e0 12 c0       	mov    %eax,0xc012e0fc
}
c0108688:	90                   	nop
c0108689:	c9                   	leave  
c010868a:	c3                   	ret    

c010868b <swapfs_read>:

int
swapfs_read(swap_entry_t entry, struct Page *page) {
c010868b:	f3 0f 1e fb          	endbr32 
c010868f:	55                   	push   %ebp
c0108690:	89 e5                	mov    %esp,%ebp
c0108692:	83 ec 28             	sub    $0x28,%esp
    return ide_read_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c0108695:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108698:	89 04 24             	mov    %eax,(%esp)
c010869b:	e8 4a ff ff ff       	call   c01085ea <page2kva>
c01086a0:	8b 55 08             	mov    0x8(%ebp),%edx
c01086a3:	c1 ea 08             	shr    $0x8,%edx
c01086a6:	89 55 f4             	mov    %edx,-0xc(%ebp)
c01086a9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c01086ad:	74 0b                	je     c01086ba <swapfs_read+0x2f>
c01086af:	8b 15 fc e0 12 c0    	mov    0xc012e0fc,%edx
c01086b5:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c01086b8:	72 23                	jb     c01086dd <swapfs_read+0x52>
c01086ba:	8b 45 08             	mov    0x8(%ebp),%eax
c01086bd:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01086c1:	c7 44 24 08 a0 bf 10 	movl   $0xc010bfa0,0x8(%esp)
c01086c8:	c0 
c01086c9:	c7 44 24 04 14 00 00 	movl   $0x14,0x4(%esp)
c01086d0:	00 
c01086d1:	c7 04 24 8f bf 10 c0 	movl   $0xc010bf8f,(%esp)
c01086d8:	e8 60 7d ff ff       	call   c010043d <__panic>
c01086dd:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01086e0:	c1 e2 03             	shl    $0x3,%edx
c01086e3:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c01086ea:	00 
c01086eb:	89 44 24 08          	mov    %eax,0x8(%esp)
c01086ef:	89 54 24 04          	mov    %edx,0x4(%esp)
c01086f3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c01086fa:	e8 39 8a ff ff       	call   c0101138 <ide_read_secs>
}
c01086ff:	c9                   	leave  
c0108700:	c3                   	ret    

c0108701 <swapfs_write>:

int
swapfs_write(swap_entry_t entry, struct Page *page) {
c0108701:	f3 0f 1e fb          	endbr32 
c0108705:	55                   	push   %ebp
c0108706:	89 e5                	mov    %esp,%ebp
c0108708:	83 ec 28             	sub    $0x28,%esp
    return ide_write_secs(SWAP_DEV_NO, swap_offset(entry) * PAGE_NSECT, page2kva(page), PAGE_NSECT);
c010870b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010870e:	89 04 24             	mov    %eax,(%esp)
c0108711:	e8 d4 fe ff ff       	call   c01085ea <page2kva>
c0108716:	8b 55 08             	mov    0x8(%ebp),%edx
c0108719:	c1 ea 08             	shr    $0x8,%edx
c010871c:	89 55 f4             	mov    %edx,-0xc(%ebp)
c010871f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108723:	74 0b                	je     c0108730 <swapfs_write+0x2f>
c0108725:	8b 15 fc e0 12 c0    	mov    0xc012e0fc,%edx
c010872b:	39 55 f4             	cmp    %edx,-0xc(%ebp)
c010872e:	72 23                	jb     c0108753 <swapfs_write+0x52>
c0108730:	8b 45 08             	mov    0x8(%ebp),%eax
c0108733:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108737:	c7 44 24 08 a0 bf 10 	movl   $0xc010bfa0,0x8(%esp)
c010873e:	c0 
c010873f:	c7 44 24 04 19 00 00 	movl   $0x19,0x4(%esp)
c0108746:	00 
c0108747:	c7 04 24 8f bf 10 c0 	movl   $0xc010bf8f,(%esp)
c010874e:	e8 ea 7c ff ff       	call   c010043d <__panic>
c0108753:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0108756:	c1 e2 03             	shl    $0x3,%edx
c0108759:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
c0108760:	00 
c0108761:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108765:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108769:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
c0108770:	e8 08 8c ff ff       	call   c010137d <ide_write_secs>
}
c0108775:	c9                   	leave  
c0108776:	c3                   	ret    

c0108777 <switch_to>:
.text
.globl switch_to
switch_to:                      # switch_to(from, to)，from是idleproc的context，to是init_proc的context

    # save from's registers
    movl 4(%esp), %eax          # eax points to from，4(%esp)：esp向上四个字节存的是from，即idleproc的context的地址
c0108777:	8b 44 24 04          	mov    0x4(%esp),%eax
    popl 0(%eax)                # save eip !popl 把idle_proc的eip保存到了context中
c010877b:	8f 00                	popl   (%eax)
    movl %esp, 4(%eax)          # save esp::context of from
c010877d:	89 60 04             	mov    %esp,0x4(%eax)
    movl %ebx, 8(%eax)          # save ebx::context of from
c0108780:	89 58 08             	mov    %ebx,0x8(%eax)
    movl %ecx, 12(%eax)         # save ecx::context of from
c0108783:	89 48 0c             	mov    %ecx,0xc(%eax)
    movl %edx, 16(%eax)         # save edx::context of from
c0108786:	89 50 10             	mov    %edx,0x10(%eax)
    movl %esi, 20(%eax)         # save esi::context of from
c0108789:	89 70 14             	mov    %esi,0x14(%eax)
    movl %edi, 24(%eax)         # save edi::context of from
c010878c:	89 78 18             	mov    %edi,0x18(%eax)
    movl %ebp, 28(%eax)         # save ebp::context of from
c010878f:	89 68 1c             	mov    %ebp,0x1c(%eax)

    # restore to's registers
    movl 4(%esp), %eax          # not 8(%esp): popped return address already  eax存的是init_proc的context的地址
c0108792:	8b 44 24 04          	mov    0x4(%esp),%eax
                                # eax now points to to
    movl 28(%eax), %ebp         # restore ebp::context of to
c0108796:	8b 68 1c             	mov    0x1c(%eax),%ebp
    movl 24(%eax), %edi         # restore edi::context of to
c0108799:	8b 78 18             	mov    0x18(%eax),%edi
    movl 20(%eax), %esi         # restore esi::context of to
c010879c:	8b 70 14             	mov    0x14(%eax),%esi
    movl 16(%eax), %edx         # restore edx::context of to
c010879f:	8b 50 10             	mov    0x10(%eax),%edx
    movl 12(%eax), %ecx         # restore ecx::context of to
c01087a2:	8b 48 0c             	mov    0xc(%eax),%ecx
    movl 8(%eax), %ebx          # restore ebx::context of to
c01087a5:	8b 58 08             	mov    0x8(%eax),%ebx
    movl 4(%eax), %esp          # restore esp::context of to
c01087a8:	8b 60 04             	mov    0x4(%eax),%esp

    pushl 0(%eax)               # push eip eip中是fork ret的地址
c01087ab:	ff 30                	pushl  (%eax)

    ret
c01087ad:	c3                   	ret    

c01087ae <kernel_thread_entry>:
.text
.globl kernel_thread_entry
kernel_thread_entry:        # void kernel_thread(void)

    pushl %edx              # push arg
c01087ae:	52                   	push   %edx
    call *%ebx              # call fn 在kernel_thread初始化时将fn放在了ebx中
c01087af:	ff d3                	call   *%ebx

    pushl %eax              # save the return value of fn(arg)
c01087b1:	50                   	push   %eax
    call do_exit            # call do_exit to terminate current thread
c01087b2:	e8 8b 08 00 00       	call   c0109042 <do_exit>

c01087b7 <__intr_save>:
__intr_save(void) {
c01087b7:	55                   	push   %ebp
c01087b8:	89 e5                	mov    %esp,%ebp
c01087ba:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01087bd:	9c                   	pushf  
c01087be:	58                   	pop    %eax
c01087bf:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c01087c2:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c01087c5:	25 00 02 00 00       	and    $0x200,%eax
c01087ca:	85 c0                	test   %eax,%eax
c01087cc:	74 0c                	je     c01087da <__intr_save+0x23>
        intr_disable();
c01087ce:	e8 7b 99 ff ff       	call   c010214e <intr_disable>
        return 1;
c01087d3:	b8 01 00 00 00       	mov    $0x1,%eax
c01087d8:	eb 05                	jmp    c01087df <__intr_save+0x28>
    return 0;
c01087da:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01087df:	c9                   	leave  
c01087e0:	c3                   	ret    

c01087e1 <__intr_restore>:
__intr_restore(bool flag) {
c01087e1:	55                   	push   %ebp
c01087e2:	89 e5                	mov    %esp,%ebp
c01087e4:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c01087e7:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01087eb:	74 05                	je     c01087f2 <__intr_restore+0x11>
        intr_enable();
c01087ed:	e8 50 99 ff ff       	call   c0102142 <intr_enable>
}
c01087f2:	90                   	nop
c01087f3:	c9                   	leave  
c01087f4:	c3                   	ret    

c01087f5 <page2ppn>:
page2ppn(struct Page *page) {
c01087f5:	55                   	push   %ebp
c01087f6:	89 e5                	mov    %esp,%ebp
    return page - pages;
c01087f8:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c01087fd:	8b 55 08             	mov    0x8(%ebp),%edx
c0108800:	29 c2                	sub    %eax,%edx
c0108802:	89 d0                	mov    %edx,%eax
c0108804:	c1 f8 05             	sar    $0x5,%eax
}
c0108807:	5d                   	pop    %ebp
c0108808:	c3                   	ret    

c0108809 <page2pa>:
page2pa(struct Page *page) {
c0108809:	55                   	push   %ebp
c010880a:	89 e5                	mov    %esp,%ebp
c010880c:	83 ec 04             	sub    $0x4,%esp
    return page2ppn(page) << PGSHIFT;
c010880f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108812:	89 04 24             	mov    %eax,(%esp)
c0108815:	e8 db ff ff ff       	call   c01087f5 <page2ppn>
c010881a:	c1 e0 0c             	shl    $0xc,%eax
}
c010881d:	c9                   	leave  
c010881e:	c3                   	ret    

c010881f <pa2page>:
pa2page(uintptr_t pa) {
c010881f:	55                   	push   %ebp
c0108820:	89 e5                	mov    %esp,%ebp
c0108822:	83 ec 18             	sub    $0x18,%esp
    if (PPN(pa) >= npage) {
c0108825:	8b 45 08             	mov    0x8(%ebp),%eax
c0108828:	c1 e8 0c             	shr    $0xc,%eax
c010882b:	89 c2                	mov    %eax,%edx
c010882d:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0108832:	39 c2                	cmp    %eax,%edx
c0108834:	72 1c                	jb     c0108852 <pa2page+0x33>
        panic("pa2page called with invalid pa");
c0108836:	c7 44 24 08 c0 bf 10 	movl   $0xc010bfc0,0x8(%esp)
c010883d:	c0 
c010883e:	c7 44 24 04 5f 00 00 	movl   $0x5f,0x4(%esp)
c0108845:	00 
c0108846:	c7 04 24 df bf 10 c0 	movl   $0xc010bfdf,(%esp)
c010884d:	e8 eb 7b ff ff       	call   c010043d <__panic>
    return &pages[PPN(pa)];
c0108852:	a1 40 e1 12 c0       	mov    0xc012e140,%eax
c0108857:	8b 55 08             	mov    0x8(%ebp),%edx
c010885a:	c1 ea 0c             	shr    $0xc,%edx
c010885d:	c1 e2 05             	shl    $0x5,%edx
c0108860:	01 d0                	add    %edx,%eax
}
c0108862:	c9                   	leave  
c0108863:	c3                   	ret    

c0108864 <page2kva>:
page2kva(struct Page *page) {
c0108864:	55                   	push   %ebp
c0108865:	89 e5                	mov    %esp,%ebp
c0108867:	83 ec 28             	sub    $0x28,%esp
    return KADDR(page2pa(page));
c010886a:	8b 45 08             	mov    0x8(%ebp),%eax
c010886d:	89 04 24             	mov    %eax,(%esp)
c0108870:	e8 94 ff ff ff       	call   c0108809 <page2pa>
c0108875:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108878:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010887b:	c1 e8 0c             	shr    $0xc,%eax
c010887e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108881:	a1 80 bf 12 c0       	mov    0xc012bf80,%eax
c0108886:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c0108889:	72 23                	jb     c01088ae <page2kva+0x4a>
c010888b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010888e:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0108892:	c7 44 24 08 f0 bf 10 	movl   $0xc010bff0,0x8(%esp)
c0108899:	c0 
c010889a:	c7 44 24 04 66 00 00 	movl   $0x66,0x4(%esp)
c01088a1:	00 
c01088a2:	c7 04 24 df bf 10 c0 	movl   $0xc010bfdf,(%esp)
c01088a9:	e8 8f 7b ff ff       	call   c010043d <__panic>
c01088ae:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01088b1:	2d 00 00 00 40       	sub    $0x40000000,%eax
}
c01088b6:	c9                   	leave  
c01088b7:	c3                   	ret    

c01088b8 <kva2page>:
kva2page(void *kva) {
c01088b8:	55                   	push   %ebp
c01088b9:	89 e5                	mov    %esp,%ebp
c01088bb:	83 ec 28             	sub    $0x28,%esp
    return pa2page(PADDR(kva));
c01088be:	8b 45 08             	mov    0x8(%ebp),%eax
c01088c1:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01088c4:	81 7d f4 ff ff ff bf 	cmpl   $0xbfffffff,-0xc(%ebp)
c01088cb:	77 23                	ja     c01088f0 <kva2page+0x38>
c01088cd:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01088d0:	89 44 24 0c          	mov    %eax,0xc(%esp)
c01088d4:	c7 44 24 08 14 c0 10 	movl   $0xc010c014,0x8(%esp)
c01088db:	c0 
c01088dc:	c7 44 24 04 6b 00 00 	movl   $0x6b,0x4(%esp)
c01088e3:	00 
c01088e4:	c7 04 24 df bf 10 c0 	movl   $0xc010bfdf,(%esp)
c01088eb:	e8 4d 7b ff ff       	call   c010043d <__panic>
c01088f0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01088f3:	05 00 00 00 40       	add    $0x40000000,%eax
c01088f8:	89 04 24             	mov    %eax,(%esp)
c01088fb:	e8 1f ff ff ff       	call   c010881f <pa2page>
}
c0108900:	c9                   	leave  
c0108901:	c3                   	ret    

c0108902 <alloc_proc>:
void switch_to(struct context *from, struct context *to);

// alloc_proc - alloc a proc_struct and init all fields of proc_struct
//负责分配并返回一个新的struct proc_struct结构，用于存储新建立的内核线程的管理信息。
static struct proc_struct *
alloc_proc(void) {
c0108902:	f3 0f 1e fb          	endbr32 
c0108906:	55                   	push   %ebp
c0108907:	89 e5                	mov    %esp,%ebp
c0108909:	83 ec 28             	sub    $0x28,%esp
    struct proc_struct *proc = kmalloc(sizeof(struct proc_struct));
c010890c:	c7 04 24 68 00 00 00 	movl   $0x68,(%esp)
c0108913:	e8 e3 c8 ff ff       	call   c01051fb <kmalloc>
c0108918:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (proc != NULL) {
c010891b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c010891f:	0f 84 a1 00 00 00    	je     c01089c6 <alloc_proc+0xc4>
        //LAB4:EXERCISE1 YOUR CODE
        proc->state = PROC_UNINIT;  //设置进程为“未初始化”态  
c0108925:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108928:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
        proc->pid = -1; //设置进程pid的未初始化值  
c010892f:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108932:	c7 00 ff ff ff ff    	movl   $0xffffffff,(%eax)
        proc->runs = 0;//初始化时间片  
c0108938:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010893b:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
        proc->kstack = 0;//内核栈的地址  
c0108942:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108945:	c7 40 20 00 00 00 00 	movl   $0x0,0x20(%eax)
        proc->need_resched = 0;//是否需要调度，初始化设置为0
c010894c:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010894f:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
        proc->parent = NULL;//父节点为空  
c0108956:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108959:	c7 40 54 00 00 00 00 	movl   $0x0,0x54(%eax)
        proc->mm = NULL; //内存管理初始化  
c0108960:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108963:	c7 40 28 00 00 00 00 	movl   $0x0,0x28(%eax)
        memset(&(proc->context), 0, sizeof(struct context));//进程上下文初始化  
c010896a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010896d:	83 c0 2c             	add    $0x2c,%eax
c0108970:	c7 44 24 08 20 00 00 	movl   $0x20,0x8(%esp)
c0108977:	00 
c0108978:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c010897f:	00 
c0108980:	89 04 24             	mov    %eax,(%esp)
c0108983:	e8 b6 0d 00 00       	call   c010973e <memset>
        proc->tf = NULL; //中断帧指针置为空，总是能够指向中断前的trapframe  
c0108988:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010898b:	c7 40 4c 00 00 00 00 	movl   $0x0,0x4c(%eax)
        proc->cr3 = boot_cr3;//设置内核页目录表的基址  
c0108992:	8b 15 3c e1 12 c0    	mov    0xc012e13c,%edx
c0108998:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010899b:	89 50 24             	mov    %edx,0x24(%eax)
        proc->flags = 0; //标志位初始化  
c010899e:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01089a1:	c7 40 50 00 00 00 00 	movl   $0x0,0x50(%eax)
        memset(proc->name, 0, PROC_NAME_LEN); //进程名初始化 
c01089a8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01089ab:	83 c0 04             	add    $0x4,%eax
c01089ae:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c01089b5:	00 
c01089b6:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01089bd:	00 
c01089be:	89 04 24             	mov    %eax,(%esp)
c01089c1:	e8 78 0d 00 00       	call   c010973e <memset>
    }
    return proc;
c01089c6:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c01089c9:	c9                   	leave  
c01089ca:	c3                   	ret    

c01089cb <set_proc_name>:

// set_proc_name - set the name of proc
char *
set_proc_name(struct proc_struct *proc, const char *name) {
c01089cb:	f3 0f 1e fb          	endbr32 
c01089cf:	55                   	push   %ebp
c01089d0:	89 e5                	mov    %esp,%ebp
c01089d2:	83 ec 18             	sub    $0x18,%esp
    memset(proc->name, 0, sizeof(proc->name));
c01089d5:	8b 45 08             	mov    0x8(%ebp),%eax
c01089d8:	83 c0 04             	add    $0x4,%eax
c01089db:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c01089e2:	00 
c01089e3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c01089ea:	00 
c01089eb:	89 04 24             	mov    %eax,(%esp)
c01089ee:	e8 4b 0d 00 00       	call   c010973e <memset>
    return memcpy(proc->name, name, PROC_NAME_LEN);
c01089f3:	8b 45 08             	mov    0x8(%ebp),%eax
c01089f6:	8d 50 04             	lea    0x4(%eax),%edx
c01089f9:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c0108a00:	00 
c0108a01:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108a04:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108a08:	89 14 24             	mov    %edx,(%esp)
c0108a0b:	e8 18 0e 00 00       	call   c0109828 <memcpy>
}
c0108a10:	c9                   	leave  
c0108a11:	c3                   	ret    

c0108a12 <get_proc_name>:

// get_proc_name - get the name of proc
char *
get_proc_name(struct proc_struct *proc) {
c0108a12:	f3 0f 1e fb          	endbr32 
c0108a16:	55                   	push   %ebp
c0108a17:	89 e5                	mov    %esp,%ebp
c0108a19:	83 ec 18             	sub    $0x18,%esp
    static char name[PROC_NAME_LEN + 1];
    memset(name, 0, sizeof(name));
c0108a1c:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
c0108a23:	00 
c0108a24:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108a2b:	00 
c0108a2c:	c7 04 24 44 e0 12 c0 	movl   $0xc012e044,(%esp)
c0108a33:	e8 06 0d 00 00       	call   c010973e <memset>
    return memcpy(name, proc->name, PROC_NAME_LEN);
c0108a38:	8b 45 08             	mov    0x8(%ebp),%eax
c0108a3b:	83 c0 04             	add    $0x4,%eax
c0108a3e:	c7 44 24 08 0f 00 00 	movl   $0xf,0x8(%esp)
c0108a45:	00 
c0108a46:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108a4a:	c7 04 24 44 e0 12 c0 	movl   $0xc012e044,(%esp)
c0108a51:	e8 d2 0d 00 00       	call   c0109828 <memcpy>
}
c0108a56:	c9                   	leave  
c0108a57:	c3                   	ret    

c0108a58 <get_pid>:

// get_pid - alloc a unique pid for process
static int
get_pid(void) {
c0108a58:	f3 0f 1e fb          	endbr32 
c0108a5c:	55                   	push   %ebp
c0108a5d:	89 e5                	mov    %esp,%ebp
c0108a5f:	83 ec 10             	sub    $0x10,%esp
    static_assert(MAX_PID > MAX_PROCESS);
    struct proc_struct *proc;
    list_entry_t *list = &proc_list, *le;
c0108a62:	c7 45 f8 44 e1 12 c0 	movl   $0xc012e144,-0x8(%ebp)
    static int next_safe = MAX_PID, last_pid = MAX_PID;
    if (++ last_pid >= MAX_PID) {
c0108a69:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
c0108a6e:	40                   	inc    %eax
c0108a6f:	a3 78 8a 12 c0       	mov    %eax,0xc0128a78
c0108a74:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
c0108a79:	3d ff 1f 00 00       	cmp    $0x1fff,%eax
c0108a7e:	7e 0c                	jle    c0108a8c <get_pid+0x34>
        last_pid = 1;
c0108a80:	c7 05 78 8a 12 c0 01 	movl   $0x1,0xc0128a78
c0108a87:	00 00 00 
        goto inside;
c0108a8a:	eb 14                	jmp    c0108aa0 <get_pid+0x48>
    }
    if (last_pid >= next_safe) {
c0108a8c:	8b 15 78 8a 12 c0    	mov    0xc0128a78,%edx
c0108a92:	a1 7c 8a 12 c0       	mov    0xc0128a7c,%eax
c0108a97:	39 c2                	cmp    %eax,%edx
c0108a99:	0f 8c a7 00 00 00    	jl     c0108b46 <get_pid+0xee>
    inside:
c0108a9f:	90                   	nop
        next_safe = MAX_PID;
c0108aa0:	c7 05 7c 8a 12 c0 00 	movl   $0x2000,0xc0128a7c
c0108aa7:	20 00 00 
    repeat:
        le = list;
c0108aaa:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0108aad:	89 45 fc             	mov    %eax,-0x4(%ebp)
        while ((le = list_next(le)) != list) {
c0108ab0:	eb 79                	jmp    c0108b2b <get_pid+0xd3>
            proc = le2proc(le, list_link);
c0108ab2:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108ab5:	83 e8 58             	sub    $0x58,%eax
c0108ab8:	89 45 f4             	mov    %eax,-0xc(%ebp)
            if (proc->pid == last_pid) {
c0108abb:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108abe:	8b 10                	mov    (%eax),%edx
c0108ac0:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
c0108ac5:	39 c2                	cmp    %eax,%edx
c0108ac7:	75 3c                	jne    c0108b05 <get_pid+0xad>
                if (++ last_pid >= next_safe) {
c0108ac9:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
c0108ace:	40                   	inc    %eax
c0108acf:	a3 78 8a 12 c0       	mov    %eax,0xc0128a78
c0108ad4:	8b 15 78 8a 12 c0    	mov    0xc0128a78,%edx
c0108ada:	a1 7c 8a 12 c0       	mov    0xc0128a7c,%eax
c0108adf:	39 c2                	cmp    %eax,%edx
c0108ae1:	7c 48                	jl     c0108b2b <get_pid+0xd3>
                    if (last_pid >= MAX_PID) {
c0108ae3:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
c0108ae8:	3d ff 1f 00 00       	cmp    $0x1fff,%eax
c0108aed:	7e 0a                	jle    c0108af9 <get_pid+0xa1>
                        last_pid = 1;
c0108aef:	c7 05 78 8a 12 c0 01 	movl   $0x1,0xc0128a78
c0108af6:	00 00 00 
                    }
                    next_safe = MAX_PID;
c0108af9:	c7 05 7c 8a 12 c0 00 	movl   $0x2000,0xc0128a7c
c0108b00:	20 00 00 
                    goto repeat;
c0108b03:	eb a5                	jmp    c0108aaa <get_pid+0x52>
                }
            }
            else if (proc->pid > last_pid && next_safe > proc->pid) {
c0108b05:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108b08:	8b 10                	mov    (%eax),%edx
c0108b0a:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
c0108b0f:	39 c2                	cmp    %eax,%edx
c0108b11:	7e 18                	jle    c0108b2b <get_pid+0xd3>
c0108b13:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108b16:	8b 10                	mov    (%eax),%edx
c0108b18:	a1 7c 8a 12 c0       	mov    0xc0128a7c,%eax
c0108b1d:	39 c2                	cmp    %eax,%edx
c0108b1f:	7d 0a                	jge    c0108b2b <get_pid+0xd3>
                next_safe = proc->pid;
c0108b21:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108b24:	8b 00                	mov    (%eax),%eax
c0108b26:	a3 7c 8a 12 c0       	mov    %eax,0xc0128a7c
c0108b2b:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108b2e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108b31:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b34:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c0108b37:	89 45 fc             	mov    %eax,-0x4(%ebp)
c0108b3a:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0108b3d:	3b 45 f8             	cmp    -0x8(%ebp),%eax
c0108b40:	0f 85 6c ff ff ff    	jne    c0108ab2 <get_pid+0x5a>
            }
        }
    }
    return last_pid;
c0108b46:	a1 78 8a 12 c0       	mov    0xc0128a78,%eax
}
c0108b4b:	c9                   	leave  
c0108b4c:	c3                   	ret    

c0108b4d <proc_run>:

// proc_run - make process "proc" running on cpu
// NOTE: before call switch_to, should load  base addr of "proc"'s new PDT
void
proc_run(struct proc_struct *proc) {
c0108b4d:	f3 0f 1e fb          	endbr32 
c0108b51:	55                   	push   %ebp
c0108b52:	89 e5                	mov    %esp,%ebp
c0108b54:	83 ec 28             	sub    $0x28,%esp
    if (proc != current) {
c0108b57:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0108b5c:	39 45 08             	cmp    %eax,0x8(%ebp)
c0108b5f:	74 64                	je     c0108bc5 <proc_run+0x78>
        bool intr_flag;
        struct proc_struct *prev = current, *next = proc;
c0108b61:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0108b66:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108b69:	8b 45 08             	mov    0x8(%ebp),%eax
c0108b6c:	89 45 f0             	mov    %eax,-0x10(%ebp)
        local_intr_save(intr_flag);
c0108b6f:	e8 43 fc ff ff       	call   c01087b7 <__intr_save>
c0108b74:	89 45 ec             	mov    %eax,-0x14(%ebp)
        {
            current = proc;
c0108b77:	8b 45 08             	mov    0x8(%ebp),%eax
c0108b7a:	a3 28 c0 12 c0       	mov    %eax,0xc012c028
            load_esp0(next->kstack + KSTACKSIZE);
c0108b7f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b82:	8b 40 20             	mov    0x20(%eax),%eax
c0108b85:	05 00 20 00 00       	add    $0x2000,%eax
c0108b8a:	89 04 24             	mov    %eax,(%esp)
c0108b8d:	e8 10 e1 ff ff       	call   c0106ca2 <load_esp0>
            lcr3(next->cr3);
c0108b92:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108b95:	8b 40 24             	mov    0x24(%eax),%eax
c0108b98:	89 45 e8             	mov    %eax,-0x18(%ebp)
    asm volatile ("mov %0, %%cr3" :: "r" (cr3) : "memory");
c0108b9b:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108b9e:	0f 22 d8             	mov    %eax,%cr3
}
c0108ba1:	90                   	nop
            switch_to(&(prev->context), &(next->context));//实现两个线程的切换
c0108ba2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108ba5:	8d 50 2c             	lea    0x2c(%eax),%edx
c0108ba8:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108bab:	83 c0 2c             	add    $0x2c,%eax
c0108bae:	89 54 24 04          	mov    %edx,0x4(%esp)
c0108bb2:	89 04 24             	mov    %eax,(%esp)
c0108bb5:	e8 bd fb ff ff       	call   c0108777 <switch_to>
        }
        local_intr_restore(intr_flag);
c0108bba:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108bbd:	89 04 24             	mov    %eax,(%esp)
c0108bc0:	e8 1c fc ff ff       	call   c01087e1 <__intr_restore>
    }
}
c0108bc5:	90                   	nop
c0108bc6:	c9                   	leave  
c0108bc7:	c3                   	ret    

c0108bc8 <forkret>:

// forkret -- the first kernel entry point of a new thread/process
// NOTE: the addr of forkret is setted in copy_thread function
//       after switch_to, the current proc will execute here.
static void
forkret(void) {
c0108bc8:	f3 0f 1e fb          	endbr32 
c0108bcc:	55                   	push   %ebp
c0108bcd:	89 e5                	mov    %esp,%ebp
c0108bcf:	83 ec 18             	sub    $0x18,%esp
    forkrets(current->tf);
c0108bd2:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0108bd7:	8b 40 4c             	mov    0x4c(%eax),%eax
c0108bda:	89 04 24             	mov    %eax,(%esp)
c0108bdd:	e8 7a a6 ff ff       	call   c010325c <forkrets>
}
c0108be2:	90                   	nop
c0108be3:	c9                   	leave  
c0108be4:	c3                   	ret    

c0108be5 <hash_proc>:

// hash_proc - add proc into proc hash_list
static void
hash_proc(struct proc_struct *proc) {
c0108be5:	f3 0f 1e fb          	endbr32 
c0108be9:	55                   	push   %ebp
c0108bea:	89 e5                	mov    %esp,%ebp
c0108bec:	53                   	push   %ebx
c0108bed:	83 ec 34             	sub    $0x34,%esp
    list_add(hash_list + pid_hashfn(proc->pid), &(proc->hash_link));
c0108bf0:	8b 45 08             	mov    0x8(%ebp),%eax
c0108bf3:	8d 58 60             	lea    0x60(%eax),%ebx
c0108bf6:	8b 45 08             	mov    0x8(%ebp),%eax
c0108bf9:	8b 00                	mov    (%eax),%eax
c0108bfb:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
c0108c02:	00 
c0108c03:	89 04 24             	mov    %eax,(%esp)
c0108c06:	e8 57 13 00 00       	call   c0109f62 <hash32>
c0108c0b:	c1 e0 03             	shl    $0x3,%eax
c0108c0e:	05 40 c0 12 c0       	add    $0xc012c040,%eax
c0108c13:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108c16:	89 5d f0             	mov    %ebx,-0x10(%ebp)
c0108c19:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108c1c:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0108c1f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108c22:	89 45 e8             	mov    %eax,-0x18(%ebp)
    __list_add(elm, listelm, listelm->next);
c0108c25:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108c28:	8b 40 04             	mov    0x4(%eax),%eax
c0108c2b:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0108c2e:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c0108c31:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0108c34:	89 55 e0             	mov    %edx,-0x20(%ebp)
c0108c37:	89 45 dc             	mov    %eax,-0x24(%ebp)
    prev->next = next->prev = elm;
c0108c3a:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108c3d:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0108c40:	89 10                	mov    %edx,(%eax)
c0108c42:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0108c45:	8b 10                	mov    (%eax),%edx
c0108c47:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108c4a:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0108c4d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108c50:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0108c53:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0108c56:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108c59:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108c5c:	89 10                	mov    %edx,(%eax)
}
c0108c5e:	90                   	nop
}
c0108c5f:	90                   	nop
}
c0108c60:	90                   	nop
}
c0108c61:	90                   	nop
c0108c62:	83 c4 34             	add    $0x34,%esp
c0108c65:	5b                   	pop    %ebx
c0108c66:	5d                   	pop    %ebp
c0108c67:	c3                   	ret    

c0108c68 <find_proc>:

// find_proc - find proc frome proc hash_list according to pid
struct proc_struct *
find_proc(int pid) {
c0108c68:	f3 0f 1e fb          	endbr32 
c0108c6c:	55                   	push   %ebp
c0108c6d:	89 e5                	mov    %esp,%ebp
c0108c6f:	83 ec 28             	sub    $0x28,%esp
    if (0 < pid && pid < MAX_PID) {
c0108c72:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0108c76:	7e 5e                	jle    c0108cd6 <find_proc+0x6e>
c0108c78:	81 7d 08 ff 1f 00 00 	cmpl   $0x1fff,0x8(%ebp)
c0108c7f:	7f 55                	jg     c0108cd6 <find_proc+0x6e>
        list_entry_t *list = hash_list + pid_hashfn(pid), *le = list;
c0108c81:	8b 45 08             	mov    0x8(%ebp),%eax
c0108c84:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
c0108c8b:	00 
c0108c8c:	89 04 24             	mov    %eax,(%esp)
c0108c8f:	e8 ce 12 00 00       	call   c0109f62 <hash32>
c0108c94:	c1 e0 03             	shl    $0x3,%eax
c0108c97:	05 40 c0 12 c0       	add    $0xc012c040,%eax
c0108c9c:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108c9f:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108ca2:	89 45 f4             	mov    %eax,-0xc(%ebp)
        while ((le = list_next(le)) != list) {
c0108ca5:	eb 18                	jmp    c0108cbf <find_proc+0x57>
            struct proc_struct *proc = le2proc(le, hash_link);
c0108ca7:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108caa:	83 e8 60             	sub    $0x60,%eax
c0108cad:	89 45 ec             	mov    %eax,-0x14(%ebp)
            if (proc->pid == pid) {
c0108cb0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108cb3:	8b 00                	mov    (%eax),%eax
c0108cb5:	39 45 08             	cmp    %eax,0x8(%ebp)
c0108cb8:	75 05                	jne    c0108cbf <find_proc+0x57>
                return proc;
c0108cba:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108cbd:	eb 1c                	jmp    c0108cdb <find_proc+0x73>
c0108cbf:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108cc2:	89 45 e8             	mov    %eax,-0x18(%ebp)
    return listelm->next;
c0108cc5:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108cc8:	8b 40 04             	mov    0x4(%eax),%eax
        while ((le = list_next(le)) != list) {
c0108ccb:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0108cce:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108cd1:	3b 45 f0             	cmp    -0x10(%ebp),%eax
c0108cd4:	75 d1                	jne    c0108ca7 <find_proc+0x3f>
            }
        }
    }
    return NULL;
c0108cd6:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108cdb:	c9                   	leave  
c0108cdc:	c3                   	ret    

c0108cdd <kernel_thread>:
// kernel_thread - create a kernel thread using "fn" function
// NOTE: the contents of temp trapframe tf will be copied to 
//       proc->tf in do_fork-->copy_thread function
//通过调用kernel_thread函数创建了一个内核线程init_main。
int
kernel_thread(int (*fn)(void *), void *arg, uint32_t clone_flags) {
c0108cdd:	f3 0f 1e fb          	endbr32 
c0108ce1:	55                   	push   %ebp
c0108ce2:	89 e5                	mov    %esp,%ebp
c0108ce4:	83 ec 68             	sub    $0x68,%esp
    struct trapframe tf;
    memset(&tf, 0, sizeof(struct trapframe));
c0108ce7:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
c0108cee:	00 
c0108cef:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108cf6:	00 
c0108cf7:	8d 45 ac             	lea    -0x54(%ebp),%eax
c0108cfa:	89 04 24             	mov    %eax,(%esp)
c0108cfd:	e8 3c 0a 00 00       	call   c010973e <memset>
    tf.tf_cs = KERNEL_CS;//代码段是在内核里
c0108d02:	66 c7 45 e8 08 00    	movw   $0x8,-0x18(%ebp)
    tf.tf_ds = tf.tf_es = tf.tf_ss = KERNEL_DS;//数据段在内核里
c0108d08:	66 c7 45 f4 10 00    	movw   $0x10,-0xc(%ebp)
c0108d0e:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
c0108d12:	66 89 45 d4          	mov    %ax,-0x2c(%ebp)
c0108d16:	0f b7 45 d4          	movzwl -0x2c(%ebp),%eax
c0108d1a:	66 89 45 d8          	mov    %ax,-0x28(%ebp)
    tf.tf_regs.reg_ebx = (uint32_t)fn;//fn代表实际的入口地址/* ebx指向函数地址 */
c0108d1e:	8b 45 08             	mov    0x8(%ebp),%eax
c0108d21:	89 45 bc             	mov    %eax,-0x44(%ebp)
    tf.tf_regs.reg_edx = (uint32_t)arg;/* edx指向参数 */ 
c0108d24:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108d27:	89 45 c0             	mov    %eax,-0x40(%ebp)
    tf.tf_eip = (uint32_t)kernel_thread_entry;
c0108d2a:	b8 ae 87 10 c0       	mov    $0xc01087ae,%eax
c0108d2f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return do_fork(clone_flags | CLONE_VM, 0, &tf);
c0108d32:	8b 45 10             	mov    0x10(%ebp),%eax
c0108d35:	0d 00 01 00 00       	or     $0x100,%eax
c0108d3a:	89 c2                	mov    %eax,%edx
c0108d3c:	8d 45 ac             	lea    -0x54(%ebp),%eax
c0108d3f:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108d43:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
c0108d4a:	00 
c0108d4b:	89 14 24             	mov    %edx,(%esp)
c0108d4e:	e8 98 01 00 00       	call   c0108eeb <do_fork>
}
c0108d53:	c9                   	leave  
c0108d54:	c3                   	ret    

c0108d55 <setup_kstack>:

// setup_kstack - alloc pages with size KSTACKPAGE as process kernel stack
static int
setup_kstack(struct proc_struct *proc) {
c0108d55:	f3 0f 1e fb          	endbr32 
c0108d59:	55                   	push   %ebp
c0108d5a:	89 e5                	mov    %esp,%ebp
c0108d5c:	83 ec 28             	sub    $0x28,%esp
    struct Page *page = alloc_pages(KSTACKPAGE);
c0108d5f:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
c0108d66:	e8 93 e0 ff ff       	call   c0106dfe <alloc_pages>
c0108d6b:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (page != NULL) {
c0108d6e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
c0108d72:	74 1a                	je     c0108d8e <setup_kstack+0x39>
        proc->kstack = (uintptr_t)page2kva(page);
c0108d74:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0108d77:	89 04 24             	mov    %eax,(%esp)
c0108d7a:	e8 e5 fa ff ff       	call   c0108864 <page2kva>
c0108d7f:	89 c2                	mov    %eax,%edx
c0108d81:	8b 45 08             	mov    0x8(%ebp),%eax
c0108d84:	89 50 20             	mov    %edx,0x20(%eax)
        return 0;
c0108d87:	b8 00 00 00 00       	mov    $0x0,%eax
c0108d8c:	eb 05                	jmp    c0108d93 <setup_kstack+0x3e>
    }
    return -E_NO_MEM;
c0108d8e:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
}
c0108d93:	c9                   	leave  
c0108d94:	c3                   	ret    

c0108d95 <put_kstack>:

// put_kstack - free the memory space of process kernel stack
static void
put_kstack(struct proc_struct *proc) {
c0108d95:	f3 0f 1e fb          	endbr32 
c0108d99:	55                   	push   %ebp
c0108d9a:	89 e5                	mov    %esp,%ebp
c0108d9c:	83 ec 18             	sub    $0x18,%esp
    free_pages(kva2page((void *)(proc->kstack)), KSTACKPAGE);
c0108d9f:	8b 45 08             	mov    0x8(%ebp),%eax
c0108da2:	8b 40 20             	mov    0x20(%eax),%eax
c0108da5:	89 04 24             	mov    %eax,(%esp)
c0108da8:	e8 0b fb ff ff       	call   c01088b8 <kva2page>
c0108dad:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
c0108db4:	00 
c0108db5:	89 04 24             	mov    %eax,(%esp)
c0108db8:	e8 b0 e0 ff ff       	call   c0106e6d <free_pages>
}
c0108dbd:	90                   	nop
c0108dbe:	c9                   	leave  
c0108dbf:	c3                   	ret    

c0108dc0 <copy_mm>:

// copy_mm - process "proc" duplicate OR share process "current"'s mm according clone_flags
//         - if clone_flags & CLONE_VM, then "share" ; else "duplicate"
static int
copy_mm(uint32_t clone_flags, struct proc_struct *proc) {
c0108dc0:	f3 0f 1e fb          	endbr32 
c0108dc4:	55                   	push   %ebp
c0108dc5:	89 e5                	mov    %esp,%ebp
c0108dc7:	83 ec 18             	sub    $0x18,%esp
    assert(current->mm == NULL);
c0108dca:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0108dcf:	8b 40 28             	mov    0x28(%eax),%eax
c0108dd2:	85 c0                	test   %eax,%eax
c0108dd4:	74 24                	je     c0108dfa <copy_mm+0x3a>
c0108dd6:	c7 44 24 0c 38 c0 10 	movl   $0xc010c038,0xc(%esp)
c0108ddd:	c0 
c0108dde:	c7 44 24 08 4c c0 10 	movl   $0xc010c04c,0x8(%esp)
c0108de5:	c0 
c0108de6:	c7 44 24 04 f1 00 00 	movl   $0xf1,0x4(%esp)
c0108ded:	00 
c0108dee:	c7 04 24 61 c0 10 c0 	movl   $0xc010c061,(%esp)
c0108df5:	e8 43 76 ff ff       	call   c010043d <__panic>
    /* do nothing in this project */
    return 0;
c0108dfa:	b8 00 00 00 00       	mov    $0x0,%eax
}
c0108dff:	c9                   	leave  
c0108e00:	c3                   	ret    

c0108e01 <copy_thread>:

// copy_thread - setup the trapframe on the  process's kernel stack top and
//             - setup the kernel entry point and stack of process
static void
copy_thread(struct proc_struct *proc, uintptr_t esp, struct trapframe *tf) {
c0108e01:	f3 0f 1e fb          	endbr32 
c0108e05:	55                   	push   %ebp
c0108e06:	89 e5                	mov    %esp,%ebp
c0108e08:	57                   	push   %edi
c0108e09:	56                   	push   %esi
c0108e0a:	53                   	push   %ebx
    //在内核堆栈的顶部设置中断帧大小的一块栈空间
    proc->tf = (struct trapframe *)(proc->kstack + KSTACKSIZE) - 1;
c0108e0b:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e0e:	8b 40 20             	mov    0x20(%eax),%eax
c0108e11:	05 b4 1f 00 00       	add    $0x1fb4,%eax
c0108e16:	89 c2                	mov    %eax,%edx
c0108e18:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e1b:	89 50 4c             	mov    %edx,0x4c(%eax)
    *(proc->tf) = *tf;//拷贝在kernel_thread函数建立的临时中断帧的初始值
c0108e1e:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e21:	8b 40 4c             	mov    0x4c(%eax),%eax
c0108e24:	8b 55 10             	mov    0x10(%ebp),%edx
c0108e27:	bb 4c 00 00 00       	mov    $0x4c,%ebx
c0108e2c:	89 c1                	mov    %eax,%ecx
c0108e2e:	83 e1 01             	and    $0x1,%ecx
c0108e31:	85 c9                	test   %ecx,%ecx
c0108e33:	74 0c                	je     c0108e41 <copy_thread+0x40>
c0108e35:	0f b6 0a             	movzbl (%edx),%ecx
c0108e38:	88 08                	mov    %cl,(%eax)
c0108e3a:	8d 40 01             	lea    0x1(%eax),%eax
c0108e3d:	8d 52 01             	lea    0x1(%edx),%edx
c0108e40:	4b                   	dec    %ebx
c0108e41:	89 c1                	mov    %eax,%ecx
c0108e43:	83 e1 02             	and    $0x2,%ecx
c0108e46:	85 c9                	test   %ecx,%ecx
c0108e48:	74 0f                	je     c0108e59 <copy_thread+0x58>
c0108e4a:	0f b7 0a             	movzwl (%edx),%ecx
c0108e4d:	66 89 08             	mov    %cx,(%eax)
c0108e50:	8d 40 02             	lea    0x2(%eax),%eax
c0108e53:	8d 52 02             	lea    0x2(%edx),%edx
c0108e56:	83 eb 02             	sub    $0x2,%ebx
c0108e59:	89 df                	mov    %ebx,%edi
c0108e5b:	83 e7 fc             	and    $0xfffffffc,%edi
c0108e5e:	b9 00 00 00 00       	mov    $0x0,%ecx
c0108e63:	8b 34 0a             	mov    (%edx,%ecx,1),%esi
c0108e66:	89 34 08             	mov    %esi,(%eax,%ecx,1)
c0108e69:	83 c1 04             	add    $0x4,%ecx
c0108e6c:	39 f9                	cmp    %edi,%ecx
c0108e6e:	72 f3                	jb     c0108e63 <copy_thread+0x62>
c0108e70:	01 c8                	add    %ecx,%eax
c0108e72:	01 ca                	add    %ecx,%edx
c0108e74:	b9 00 00 00 00       	mov    $0x0,%ecx
c0108e79:	89 de                	mov    %ebx,%esi
c0108e7b:	83 e6 02             	and    $0x2,%esi
c0108e7e:	85 f6                	test   %esi,%esi
c0108e80:	74 0b                	je     c0108e8d <copy_thread+0x8c>
c0108e82:	0f b7 34 0a          	movzwl (%edx,%ecx,1),%esi
c0108e86:	66 89 34 08          	mov    %si,(%eax,%ecx,1)
c0108e8a:	83 c1 02             	add    $0x2,%ecx
c0108e8d:	83 e3 01             	and    $0x1,%ebx
c0108e90:	85 db                	test   %ebx,%ebx
c0108e92:	74 07                	je     c0108e9b <copy_thread+0x9a>
c0108e94:	0f b6 14 0a          	movzbl (%edx,%ecx,1),%edx
c0108e98:	88 14 08             	mov    %dl,(%eax,%ecx,1)
    proc->tf->tf_regs.reg_eax = 0;
c0108e9b:	8b 45 08             	mov    0x8(%ebp),%eax
c0108e9e:	8b 40 4c             	mov    0x4c(%eax),%eax
c0108ea1:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
    //设置子进程/线程执行完do_fork后的返回值
    proc->tf->tf_esp = esp;//设置中断帧中的栈指针esp
c0108ea8:	8b 45 08             	mov    0x8(%ebp),%eax
c0108eab:	8b 40 4c             	mov    0x4c(%eax),%eax
c0108eae:	8b 55 0c             	mov    0xc(%ebp),%edx
c0108eb1:	89 50 44             	mov    %edx,0x44(%eax)
    proc->tf->tf_eflags |= FL_IF;//使能中断
c0108eb4:	8b 45 08             	mov    0x8(%ebp),%eax
c0108eb7:	8b 40 4c             	mov    0x4c(%eax),%eax
c0108eba:	8b 50 40             	mov    0x40(%eax),%edx
c0108ebd:	8b 45 08             	mov    0x8(%ebp),%eax
c0108ec0:	8b 40 4c             	mov    0x4c(%eax),%eax
c0108ec3:	81 ca 00 02 00 00    	or     $0x200,%edx
c0108ec9:	89 50 40             	mov    %edx,0x40(%eax)

    proc->context.eip = (uintptr_t)forkret;//完成对返回中断的一个处理过程
c0108ecc:	ba c8 8b 10 c0       	mov    $0xc0108bc8,%edx
c0108ed1:	8b 45 08             	mov    0x8(%ebp),%eax
c0108ed4:	89 50 2c             	mov    %edx,0x2c(%eax)
    proc->context.esp = (uintptr_t)(proc->tf);//当前的栈顶指针指向proc->tf
c0108ed7:	8b 45 08             	mov    0x8(%ebp),%eax
c0108eda:	8b 40 4c             	mov    0x4c(%eax),%eax
c0108edd:	89 c2                	mov    %eax,%edx
c0108edf:	8b 45 08             	mov    0x8(%ebp),%eax
c0108ee2:	89 50 30             	mov    %edx,0x30(%eax)
}
c0108ee5:	90                   	nop
c0108ee6:	5b                   	pop    %ebx
c0108ee7:	5e                   	pop    %esi
c0108ee8:	5f                   	pop    %edi
c0108ee9:	5d                   	pop    %ebp
c0108eea:	c3                   	ret    

c0108eeb <do_fork>:
 * @stack:       the parent's user stack pointer. if stack==0, It means to fork a kernel thread.
 * @tf:          the trapframe info, which will be copied to child process's proc->tf
 */
 //实现具体的尤其针对init_proc的内核进程控制块的初始化
int  
do_fork(uint32_t clone_flags, uintptr_t stack, struct trapframe *tf) {  
c0108eeb:	f3 0f 1e fb          	endbr32 
c0108eef:	55                   	push   %ebp
c0108ef0:	89 e5                	mov    %esp,%ebp
c0108ef2:	83 ec 48             	sub    $0x48,%esp
    int ret = -E_NO_FREE_PROC;  
c0108ef5:	c7 45 f4 fb ff ff ff 	movl   $0xfffffffb,-0xc(%ebp)
    struct proc_struct *proc;  
    if (nr_process >= MAX_PROCESS) {  
c0108efc:	a1 40 e0 12 c0       	mov    0xc012e040,%eax
c0108f01:	3d ff 0f 00 00       	cmp    $0xfff,%eax
c0108f06:	0f 8f 0b 01 00 00    	jg     c0109017 <do_fork+0x12c>
        goto fork_out;  
    }  
    ret = -E_NO_MEM;  
c0108f0c:	c7 45 f4 fc ff ff ff 	movl   $0xfffffffc,-0xc(%ebp)
    //    4. call copy_thread to setup tf & context in proc_struct  
    //    5. insert proc_struct into hash_list && proc_list  
    //    6. call wakup_proc to make the new child process RUNNABLE  
    //    7. set ret vaule using child proc's pid  
    //第一步：申请内存块，如果失败，直接返回处理  
    if ((proc = alloc_proc()) == NULL) {  
c0108f13:	e8 ea f9 ff ff       	call   c0108902 <alloc_proc>
c0108f18:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0108f1b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0108f1f:	0f 84 f5 00 00 00    	je     c010901a <do_fork+0x12f>
        goto fork_out;  
    }  
    //将子进程的父节点设置为当前进程  
    proc->parent = current;  
c0108f25:	8b 15 28 c0 12 c0    	mov    0xc012c028,%edx
c0108f2b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f2e:	89 50 54             	mov    %edx,0x54(%eax)
    //第二步：为进程分配一个内核栈  
    if (setup_kstack(proc) != 0) {  
c0108f31:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f34:	89 04 24             	mov    %eax,(%esp)
c0108f37:	e8 19 fe ff ff       	call   c0108d55 <setup_kstack>
c0108f3c:	85 c0                	test   %eax,%eax
c0108f3e:	0f 85 ee 00 00 00    	jne    c0109032 <do_fork+0x147>
        goto bad_fork_cleanup_proc;  
    }  
    //第三步：复制父进程的内存信息到子进程  
    if (copy_mm(clone_flags, proc) != 0) {  
c0108f44:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f47:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108f4b:	8b 45 08             	mov    0x8(%ebp),%eax
c0108f4e:	89 04 24             	mov    %eax,(%esp)
c0108f51:	e8 6a fe ff ff       	call   c0108dc0 <copy_mm>
c0108f56:	85 c0                	test   %eax,%eax
c0108f58:	0f 85 c2 00 00 00    	jne    c0109020 <do_fork+0x135>
        goto bad_fork_cleanup_kstack;  
    }  
    //第四步：复制父进程相关寄存器信息（上下文）  
    copy_thread(proc, stack, tf);  
c0108f5e:	8b 45 10             	mov    0x10(%ebp),%eax
c0108f61:	89 44 24 08          	mov    %eax,0x8(%esp)
c0108f65:	8b 45 0c             	mov    0xc(%ebp),%eax
c0108f68:	89 44 24 04          	mov    %eax,0x4(%esp)
c0108f6c:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f6f:	89 04 24             	mov    %eax,(%esp)
c0108f72:	e8 8a fe ff ff       	call   c0108e01 <copy_thread>
    //第五步：将新进程添加到进程列表（此过程需要加保护锁）  
    bool intr_flag;  
    local_intr_save(intr_flag);  
c0108f77:	e8 3b f8 ff ff       	call   c01087b7 <__intr_save>
c0108f7c:	89 45 ec             	mov    %eax,-0x14(%ebp)
    {  
        proc->pid = get_pid();  
c0108f7f:	e8 d4 fa ff ff       	call   c0108a58 <get_pid>
c0108f84:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0108f87:	89 02                	mov    %eax,(%edx)
    //建立散列映射方便查找  
        hash_proc(proc);  
c0108f89:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f8c:	89 04 24             	mov    %eax,(%esp)
c0108f8f:	e8 51 fc ff ff       	call   c0108be5 <hash_proc>
    //将进程链节点加入进程列表  
        list_add(&proc_list, &(proc->list_link));  
c0108f94:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0108f97:	83 c0 58             	add    $0x58,%eax
c0108f9a:	c7 45 e8 44 e1 12 c0 	movl   $0xc012e144,-0x18(%ebp)
c0108fa1:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c0108fa4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0108fa7:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0108faa:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0108fad:	89 45 dc             	mov    %eax,-0x24(%ebp)
    __list_add(elm, listelm, listelm->next);
c0108fb0:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0108fb3:	8b 40 04             	mov    0x4(%eax),%eax
c0108fb6:	8b 55 dc             	mov    -0x24(%ebp),%edx
c0108fb9:	89 55 d8             	mov    %edx,-0x28(%ebp)
c0108fbc:	8b 55 e0             	mov    -0x20(%ebp),%edx
c0108fbf:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c0108fc2:	89 45 d0             	mov    %eax,-0x30(%ebp)
    prev->next = next->prev = elm;
c0108fc5:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0108fc8:	8b 55 d8             	mov    -0x28(%ebp),%edx
c0108fcb:	89 10                	mov    %edx,(%eax)
c0108fcd:	8b 45 d0             	mov    -0x30(%ebp),%eax
c0108fd0:	8b 10                	mov    (%eax),%edx
c0108fd2:	8b 45 d4             	mov    -0x2c(%ebp),%eax
c0108fd5:	89 50 04             	mov    %edx,0x4(%eax)
    elm->next = next;
c0108fd8:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108fdb:	8b 55 d0             	mov    -0x30(%ebp),%edx
c0108fde:	89 50 04             	mov    %edx,0x4(%eax)
    elm->prev = prev;
c0108fe1:	8b 45 d8             	mov    -0x28(%ebp),%eax
c0108fe4:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c0108fe7:	89 10                	mov    %edx,(%eax)
}
c0108fe9:	90                   	nop
}
c0108fea:	90                   	nop
}
c0108feb:	90                   	nop
    //进程数+1  
        nr_process ++;  
c0108fec:	a1 40 e0 12 c0       	mov    0xc012e040,%eax
c0108ff1:	40                   	inc    %eax
c0108ff2:	a3 40 e0 12 c0       	mov    %eax,0xc012e040
    }  
        local_intr_restore(intr_flag);  
c0108ff7:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0108ffa:	89 04 24             	mov    %eax,(%esp)
c0108ffd:	e8 df f7 ff ff       	call   c01087e1 <__intr_restore>
    //第六步：一切准备就绪，唤醒子进程  
        wakeup_proc(proc);  
c0109002:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109005:	89 04 24             	mov    %eax,(%esp)
c0109008:	e8 d0 02 00 00       	call   c01092dd <wakeup_proc>
    //第七步：别忘了设置返回的子进程号  
        ret = proc->pid;  
c010900d:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109010:	8b 00                	mov    (%eax),%eax
c0109012:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109015:	eb 04                	jmp    c010901b <do_fork+0x130>
        goto fork_out;  
c0109017:	90                   	nop
c0109018:	eb 01                	jmp    c010901b <do_fork+0x130>
        goto fork_out;  
c010901a:	90                   	nop
        
    fork_out:  
        return ret;  
c010901b:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010901e:	eb 20                	jmp    c0109040 <do_fork+0x155>
        goto bad_fork_cleanup_kstack;  
c0109020:	90                   	nop
c0109021:	f3 0f 1e fb          	endbr32 

    bad_fork_cleanup_kstack:  
        put_kstack(proc);  
c0109025:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109028:	89 04 24             	mov    %eax,(%esp)
c010902b:	e8 65 fd ff ff       	call   c0108d95 <put_kstack>
c0109030:	eb 01                	jmp    c0109033 <do_fork+0x148>
        goto bad_fork_cleanup_proc;  
c0109032:	90                   	nop
    bad_fork_cleanup_proc:  
        kfree(proc);  
c0109033:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109036:	89 04 24             	mov    %eax,(%esp)
c0109039:	e8 dc c1 ff ff       	call   c010521a <kfree>
        goto fork_out;  
c010903e:	eb db                	jmp    c010901b <do_fork+0x130>
}  
c0109040:	c9                   	leave  
c0109041:	c3                   	ret    

c0109042 <do_exit>:
// do_exit - called by sys_exit
//   1. call exit_mmap & put_pgdir & mm_destroy to free the almost all memory space of process
//   2. set process' state as PROC_ZOMBIE, then call wakeup_proc(parent) to ask parent reclaim itself.
//   3. call scheduler to switch to other process
int
do_exit(int error_code) {
c0109042:	f3 0f 1e fb          	endbr32 
c0109046:	55                   	push   %ebp
c0109047:	89 e5                	mov    %esp,%ebp
c0109049:	83 ec 18             	sub    $0x18,%esp
    panic("process exit!!.\n");
c010904c:	c7 44 24 08 75 c0 10 	movl   $0xc010c075,0x8(%esp)
c0109053:	c0 
c0109054:	c7 44 24 04 5f 01 00 	movl   $0x15f,0x4(%esp)
c010905b:	00 
c010905c:	c7 04 24 61 c0 10 c0 	movl   $0xc010c061,(%esp)
c0109063:	e8 d5 73 ff ff       	call   c010043d <__panic>

c0109068 <init_main>:
}

// init_main - the second kernel thread used to create user_main kernel threads
static int
init_main(void *arg) {
c0109068:	f3 0f 1e fb          	endbr32 
c010906c:	55                   	push   %ebp
c010906d:	89 e5                	mov    %esp,%ebp
c010906f:	83 ec 18             	sub    $0x18,%esp
    cprintf("this initproc, pid = %d, name = \"%s\"\n", current->pid, get_proc_name(current));
c0109072:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0109077:	89 04 24             	mov    %eax,(%esp)
c010907a:	e8 93 f9 ff ff       	call   c0108a12 <get_proc_name>
c010907f:	8b 15 28 c0 12 c0    	mov    0xc012c028,%edx
c0109085:	8b 12                	mov    (%edx),%edx
c0109087:	89 44 24 08          	mov    %eax,0x8(%esp)
c010908b:	89 54 24 04          	mov    %edx,0x4(%esp)
c010908f:	c7 04 24 88 c0 10 c0 	movl   $0xc010c088,(%esp)
c0109096:	e8 36 72 ff ff       	call   c01002d1 <cprintf>
    cprintf("To U: \"%s\".\n", (const char *)arg);
c010909b:	8b 45 08             	mov    0x8(%ebp),%eax
c010909e:	89 44 24 04          	mov    %eax,0x4(%esp)
c01090a2:	c7 04 24 ae c0 10 c0 	movl   $0xc010c0ae,(%esp)
c01090a9:	e8 23 72 ff ff       	call   c01002d1 <cprintf>
    cprintf("To U: \"en.., Bye, Bye. :)\"\n");
c01090ae:	c7 04 24 bb c0 10 c0 	movl   $0xc010c0bb,(%esp)
c01090b5:	e8 17 72 ff ff       	call   c01002d1 <cprintf>
    return 0;
c01090ba:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01090bf:	c9                   	leave  
c01090c0:	c3                   	ret    

c01090c1 <proc_init>:

// proc_init - set up the first kernel thread idleproc "idle" by itself and 
//           - create the second kernel thread init_main
//用于创建第0个线程
void
proc_init(void) {
c01090c1:	f3 0f 1e fb          	endbr32 
c01090c5:	55                   	push   %ebp
c01090c6:	89 e5                	mov    %esp,%ebp
c01090c8:	83 ec 28             	sub    $0x28,%esp
c01090cb:	c7 45 ec 44 e1 12 c0 	movl   $0xc012e144,-0x14(%ebp)
    elm->prev = elm->next = elm;
c01090d2:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01090d5:	8b 55 ec             	mov    -0x14(%ebp),%edx
c01090d8:	89 50 04             	mov    %edx,0x4(%eax)
c01090db:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01090de:	8b 50 04             	mov    0x4(%eax),%edx
c01090e1:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01090e4:	89 10                	mov    %edx,(%eax)
}
c01090e6:	90                   	nop
    int i;

    list_init(&proc_list);//定义在list.h，初始化线程控制块链表。
    for (i = 0; i < HASH_LIST_SIZE; i ++) {//初始化哈希表
c01090e7:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
c01090ee:	eb 26                	jmp    c0109116 <proc_init+0x55>
        list_init(hash_list + i);
c01090f0:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01090f3:	c1 e0 03             	shl    $0x3,%eax
c01090f6:	05 40 c0 12 c0       	add    $0xc012c040,%eax
c01090fb:	89 45 e8             	mov    %eax,-0x18(%ebp)
    elm->prev = elm->next = elm;
c01090fe:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109101:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0109104:	89 50 04             	mov    %edx,0x4(%eax)
c0109107:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010910a:	8b 50 04             	mov    0x4(%eax),%edx
c010910d:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109110:	89 10                	mov    %edx,(%eax)
}
c0109112:	90                   	nop
    for (i = 0; i < HASH_LIST_SIZE; i ++) {//初始化哈希表
c0109113:	ff 45 f4             	incl   -0xc(%ebp)
c0109116:	81 7d f4 ff 03 00 00 	cmpl   $0x3ff,-0xc(%ebp)
c010911d:	7e d1                	jle    c01090f0 <proc_init+0x2f>
    }

    if ((idleproc = alloc_proc()) == NULL) {//为idleproc分配空间
c010911f:	e8 de f7 ff ff       	call   c0108902 <alloc_proc>
c0109124:	a3 20 c0 12 c0       	mov    %eax,0xc012c020
c0109129:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c010912e:	85 c0                	test   %eax,%eax
c0109130:	75 1c                	jne    c010914e <proc_init+0x8d>
        panic("cannot alloc idleproc.\n");
c0109132:	c7 44 24 08 d7 c0 10 	movl   $0xc010c0d7,0x8(%esp)
c0109139:	c0 
c010913a:	c7 44 24 04 78 01 00 	movl   $0x178,0x4(%esp)
c0109141:	00 
c0109142:	c7 04 24 61 c0 10 c0 	movl   $0xc010c061,(%esp)
c0109149:	e8 ef 72 ff ff       	call   c010043d <__panic>
    }

    idleproc->pid = 0;//第0个进程：idleproc
c010914e:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109153:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
    idleproc->state = PROC_RUNNABLE;//当前处于就绪态
c0109159:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c010915e:	c7 40 14 02 00 00 00 	movl   $0x2,0x14(%eax)
    idleproc->kstack = (uintptr_t)bootstack;//给他设置一个内核堆栈
c0109165:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c010916a:	ba 00 60 12 c0       	mov    $0xc0126000,%edx
c010916f:	89 50 20             	mov    %edx,0x20(%eax)
    idleproc->need_resched = 1;//设置为需要被调度
c0109172:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109177:	c7 40 1c 01 00 00 00 	movl   $0x1,0x1c(%eax)
    set_proc_name(idleproc, "idle");//设置名字
c010917e:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109183:	c7 44 24 04 ef c0 10 	movl   $0xc010c0ef,0x4(%esp)
c010918a:	c0 
c010918b:	89 04 24             	mov    %eax,(%esp)
c010918e:	e8 38 f8 ff ff       	call   c01089cb <set_proc_name>
    nr_process ++;//进程数加一
c0109193:	a1 40 e0 12 c0       	mov    0xc012e040,%eax
c0109198:	40                   	inc    %eax
c0109199:	a3 40 e0 12 c0       	mov    %eax,0xc012e040

    current = idleproc;//当前进程为0号进程：idleproc
c010919e:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c01091a3:	a3 28 c0 12 c0       	mov    %eax,0xc012c028

    int pid = kernel_thread(init_main, "Hello world!!", 0);//kernel_thread函数的作用是产生一个新的线程
c01091a8:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
c01091af:	00 
c01091b0:	c7 44 24 04 f4 c0 10 	movl   $0xc010c0f4,0x4(%esp)
c01091b7:	c0 
c01091b8:	c7 04 24 68 90 10 c0 	movl   $0xc0109068,(%esp)
c01091bf:	e8 19 fb ff ff       	call   c0108cdd <kernel_thread>
c01091c4:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if (pid <= 0) {
c01091c7:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01091cb:	7f 1c                	jg     c01091e9 <proc_init+0x128>
        panic("create init_main failed.\n");
c01091cd:	c7 44 24 08 02 c1 10 	movl   $0xc010c102,0x8(%esp)
c01091d4:	c0 
c01091d5:	c7 44 24 04 86 01 00 	movl   $0x186,0x4(%esp)
c01091dc:	00 
c01091dd:	c7 04 24 61 c0 10 c0 	movl   $0xc010c061,(%esp)
c01091e4:	e8 54 72 ff ff       	call   c010043d <__panic>
    }

    initproc = find_proc(pid);
c01091e9:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01091ec:	89 04 24             	mov    %eax,(%esp)
c01091ef:	e8 74 fa ff ff       	call   c0108c68 <find_proc>
c01091f4:	a3 24 c0 12 c0       	mov    %eax,0xc012c024
    set_proc_name(initproc, "init");
c01091f9:	a1 24 c0 12 c0       	mov    0xc012c024,%eax
c01091fe:	c7 44 24 04 1c c1 10 	movl   $0xc010c11c,0x4(%esp)
c0109205:	c0 
c0109206:	89 04 24             	mov    %eax,(%esp)
c0109209:	e8 bd f7 ff ff       	call   c01089cb <set_proc_name>

    assert(idleproc != NULL && idleproc->pid == 0);
c010920e:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c0109213:	85 c0                	test   %eax,%eax
c0109215:	74 0b                	je     c0109222 <proc_init+0x161>
c0109217:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c010921c:	8b 00                	mov    (%eax),%eax
c010921e:	85 c0                	test   %eax,%eax
c0109220:	74 24                	je     c0109246 <proc_init+0x185>
c0109222:	c7 44 24 0c 24 c1 10 	movl   $0xc010c124,0xc(%esp)
c0109229:	c0 
c010922a:	c7 44 24 08 4c c0 10 	movl   $0xc010c04c,0x8(%esp)
c0109231:	c0 
c0109232:	c7 44 24 04 8c 01 00 	movl   $0x18c,0x4(%esp)
c0109239:	00 
c010923a:	c7 04 24 61 c0 10 c0 	movl   $0xc010c061,(%esp)
c0109241:	e8 f7 71 ff ff       	call   c010043d <__panic>
    assert(initproc != NULL && initproc->pid == 1);
c0109246:	a1 24 c0 12 c0       	mov    0xc012c024,%eax
c010924b:	85 c0                	test   %eax,%eax
c010924d:	74 0c                	je     c010925b <proc_init+0x19a>
c010924f:	a1 24 c0 12 c0       	mov    0xc012c024,%eax
c0109254:	8b 00                	mov    (%eax),%eax
c0109256:	83 f8 01             	cmp    $0x1,%eax
c0109259:	74 24                	je     c010927f <proc_init+0x1be>
c010925b:	c7 44 24 0c 4c c1 10 	movl   $0xc010c14c,0xc(%esp)
c0109262:	c0 
c0109263:	c7 44 24 08 4c c0 10 	movl   $0xc010c04c,0x8(%esp)
c010926a:	c0 
c010926b:	c7 44 24 04 8d 01 00 	movl   $0x18d,0x4(%esp)
c0109272:	00 
c0109273:	c7 04 24 61 c0 10 c0 	movl   $0xc010c061,(%esp)
c010927a:	e8 be 71 ff ff       	call   c010043d <__panic>
}
c010927f:	90                   	nop
c0109280:	c9                   	leave  
c0109281:	c3                   	ret    

c0109282 <cpu_idle>:

// cpu_idle - at the end of kern_init, the first kernel thread idleproc will do below works
//去查找当前的idle_proc是否是需要调度的
void
cpu_idle(void) {
c0109282:	f3 0f 1e fb          	endbr32 
c0109286:	55                   	push   %ebp
c0109287:	89 e5                	mov    %esp,%ebp
c0109289:	83 ec 08             	sub    $0x8,%esp
    while (1) {
        if (current->need_resched) {
c010928c:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0109291:	8b 40 1c             	mov    0x1c(%eax),%eax
c0109294:	85 c0                	test   %eax,%eax
c0109296:	74 f4                	je     c010928c <cpu_idle+0xa>
            schedule();
c0109298:	e8 91 00 00 00       	call   c010932e <schedule>
        if (current->need_resched) {
c010929d:	eb ed                	jmp    c010928c <cpu_idle+0xa>

c010929f <__intr_save>:
__intr_save(void) {
c010929f:	55                   	push   %ebp
c01092a0:	89 e5                	mov    %esp,%ebp
c01092a2:	83 ec 18             	sub    $0x18,%esp
    asm volatile ("pushfl; popl %0" : "=r" (eflags));
c01092a5:	9c                   	pushf  
c01092a6:	58                   	pop    %eax
c01092a7:	89 45 f4             	mov    %eax,-0xc(%ebp)
    return eflags;
c01092aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
    if (read_eflags() & FL_IF) {
c01092ad:	25 00 02 00 00       	and    $0x200,%eax
c01092b2:	85 c0                	test   %eax,%eax
c01092b4:	74 0c                	je     c01092c2 <__intr_save+0x23>
        intr_disable();
c01092b6:	e8 93 8e ff ff       	call   c010214e <intr_disable>
        return 1;
c01092bb:	b8 01 00 00 00       	mov    $0x1,%eax
c01092c0:	eb 05                	jmp    c01092c7 <__intr_save+0x28>
    return 0;
c01092c2:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01092c7:	c9                   	leave  
c01092c8:	c3                   	ret    

c01092c9 <__intr_restore>:
__intr_restore(bool flag) {
c01092c9:	55                   	push   %ebp
c01092ca:	89 e5                	mov    %esp,%ebp
c01092cc:	83 ec 08             	sub    $0x8,%esp
    if (flag) {
c01092cf:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c01092d3:	74 05                	je     c01092da <__intr_restore+0x11>
        intr_enable();
c01092d5:	e8 68 8e ff ff       	call   c0102142 <intr_enable>
}
c01092da:	90                   	nop
c01092db:	c9                   	leave  
c01092dc:	c3                   	ret    

c01092dd <wakeup_proc>:
#include <proc.h>
#include <sched.h>
#include <assert.h>

void
wakeup_proc(struct proc_struct *proc) {
c01092dd:	f3 0f 1e fb          	endbr32 
c01092e1:	55                   	push   %ebp
c01092e2:	89 e5                	mov    %esp,%ebp
c01092e4:	83 ec 18             	sub    $0x18,%esp
    assert(proc->state != PROC_ZOMBIE && proc->state != PROC_RUNNABLE);
c01092e7:	8b 45 08             	mov    0x8(%ebp),%eax
c01092ea:	8b 40 14             	mov    0x14(%eax),%eax
c01092ed:	83 f8 03             	cmp    $0x3,%eax
c01092f0:	74 0b                	je     c01092fd <wakeup_proc+0x20>
c01092f2:	8b 45 08             	mov    0x8(%ebp),%eax
c01092f5:	8b 40 14             	mov    0x14(%eax),%eax
c01092f8:	83 f8 02             	cmp    $0x2,%eax
c01092fb:	75 24                	jne    c0109321 <wakeup_proc+0x44>
c01092fd:	c7 44 24 0c 74 c1 10 	movl   $0xc010c174,0xc(%esp)
c0109304:	c0 
c0109305:	c7 44 24 08 af c1 10 	movl   $0xc010c1af,0x8(%esp)
c010930c:	c0 
c010930d:	c7 44 24 04 09 00 00 	movl   $0x9,0x4(%esp)
c0109314:	00 
c0109315:	c7 04 24 c4 c1 10 c0 	movl   $0xc010c1c4,(%esp)
c010931c:	e8 1c 71 ff ff       	call   c010043d <__panic>
    proc->state = PROC_RUNNABLE;
c0109321:	8b 45 08             	mov    0x8(%ebp),%eax
c0109324:	c7 40 14 02 00 00 00 	movl   $0x2,0x14(%eax)
}
c010932b:	90                   	nop
c010932c:	c9                   	leave  
c010932d:	c3                   	ret    

c010932e <schedule>:

void
schedule(void) {
c010932e:	f3 0f 1e fb          	endbr32 
c0109332:	55                   	push   %ebp
c0109333:	89 e5                	mov    %esp,%ebp
c0109335:	83 ec 38             	sub    $0x38,%esp
    bool intr_flag;
    list_entry_t *le, *last;
    struct proc_struct *next = NULL;
c0109338:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    local_intr_save(intr_flag);
c010933f:	e8 5b ff ff ff       	call   c010929f <__intr_save>
c0109344:	89 45 ec             	mov    %eax,-0x14(%ebp)
    {
        current->need_resched = 0;//设置当前内核线程current->need_resched为0；
c0109347:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c010934c:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
        //proc_list队列存储着所有状态的进程/线程，在其中查找下一个处于“就绪”态的线程或进程next；
        last = (current == idleproc) ? &proc_list : &(current->list_link);
c0109353:	8b 15 28 c0 12 c0    	mov    0xc012c028,%edx
c0109359:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c010935e:	39 c2                	cmp    %eax,%edx
c0109360:	74 0a                	je     c010936c <schedule+0x3e>
c0109362:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c0109367:	83 c0 58             	add    $0x58,%eax
c010936a:	eb 05                	jmp    c0109371 <schedule+0x43>
c010936c:	b8 44 e1 12 c0       	mov    $0xc012e144,%eax
c0109371:	89 45 e8             	mov    %eax,-0x18(%ebp)
        le = last;
c0109374:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109377:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010937a:	8b 45 f4             	mov    -0xc(%ebp),%eax
c010937d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    return listelm->next;
c0109380:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109383:	8b 40 04             	mov    0x4(%eax),%eax
        do {
            if ((le = list_next(le)) != &proc_list) {
c0109386:	89 45 f4             	mov    %eax,-0xc(%ebp)
c0109389:	81 7d f4 44 e1 12 c0 	cmpl   $0xc012e144,-0xc(%ebp)
c0109390:	74 14                	je     c01093a6 <schedule+0x78>
                next = le2proc(le, list_link);
c0109392:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109395:	83 e8 58             	sub    $0x58,%eax
c0109398:	89 45 f0             	mov    %eax,-0x10(%ebp)
                if (next->state == PROC_RUNNABLE) {
c010939b:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010939e:	8b 40 14             	mov    0x14(%eax),%eax
c01093a1:	83 f8 02             	cmp    $0x2,%eax
c01093a4:	74 0a                	je     c01093b0 <schedule+0x82>
                    break;
                }
            }
        } while (le != last);
c01093a6:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01093a9:	3b 45 e8             	cmp    -0x18(%ebp),%eax
c01093ac:	75 cc                	jne    c010937a <schedule+0x4c>
c01093ae:	eb 01                	jmp    c01093b1 <schedule+0x83>
                    break;
c01093b0:	90                   	nop
        if (next == NULL || next->state != PROC_RUNNABLE) {
c01093b1:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c01093b5:	74 0b                	je     c01093c2 <schedule+0x94>
c01093b7:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093ba:	8b 40 14             	mov    0x14(%eax),%eax
c01093bd:	83 f8 02             	cmp    $0x2,%eax
c01093c0:	74 08                	je     c01093ca <schedule+0x9c>
            next = idleproc;
c01093c2:	a1 20 c0 12 c0       	mov    0xc012c020,%eax
c01093c7:	89 45 f0             	mov    %eax,-0x10(%ebp)
        }
        next->runs ++;
c01093ca:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093cd:	8b 40 18             	mov    0x18(%eax),%eax
c01093d0:	8d 50 01             	lea    0x1(%eax),%edx
c01093d3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093d6:	89 50 18             	mov    %edx,0x18(%eax)
        //找到这样的进程后，就调用proc_run函数，保存当前进程current的执行现场（进程上下文），恢复新进程的执行现场，完成进程切换。
        if (next != current) {
c01093d9:	a1 28 c0 12 c0       	mov    0xc012c028,%eax
c01093de:	39 45 f0             	cmp    %eax,-0x10(%ebp)
c01093e1:	74 0b                	je     c01093ee <schedule+0xc0>
            proc_run(next);
c01093e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01093e6:	89 04 24             	mov    %eax,(%esp)
c01093e9:	e8 5f f7 ff ff       	call   c0108b4d <proc_run>
        }
    }
    local_intr_restore(intr_flag);
c01093ee:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01093f1:	89 04 24             	mov    %eax,(%esp)
c01093f4:	e8 d0 fe ff ff       	call   c01092c9 <__intr_restore>
}
c01093f9:	90                   	nop
c01093fa:	c9                   	leave  
c01093fb:	c3                   	ret    

c01093fc <strlen>:
 * @s:      the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
c01093fc:	f3 0f 1e fb          	endbr32 
c0109400:	55                   	push   %ebp
c0109401:	89 e5                	mov    %esp,%ebp
c0109403:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c0109406:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (*s ++ != '\0') {
c010940d:	eb 03                	jmp    c0109412 <strlen+0x16>
        cnt ++;
c010940f:	ff 45 fc             	incl   -0x4(%ebp)
    while (*s ++ != '\0') {
c0109412:	8b 45 08             	mov    0x8(%ebp),%eax
c0109415:	8d 50 01             	lea    0x1(%eax),%edx
c0109418:	89 55 08             	mov    %edx,0x8(%ebp)
c010941b:	0f b6 00             	movzbl (%eax),%eax
c010941e:	84 c0                	test   %al,%al
c0109420:	75 ed                	jne    c010940f <strlen+0x13>
    }
    return cnt;
c0109422:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0109425:	c9                   	leave  
c0109426:	c3                   	ret    

c0109427 <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
c0109427:	f3 0f 1e fb          	endbr32 
c010942b:	55                   	push   %ebp
c010942c:	89 e5                	mov    %esp,%ebp
c010942e:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
c0109431:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c0109438:	eb 03                	jmp    c010943d <strnlen+0x16>
        cnt ++;
c010943a:	ff 45 fc             	incl   -0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
c010943d:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109440:	3b 45 0c             	cmp    0xc(%ebp),%eax
c0109443:	73 10                	jae    c0109455 <strnlen+0x2e>
c0109445:	8b 45 08             	mov    0x8(%ebp),%eax
c0109448:	8d 50 01             	lea    0x1(%eax),%edx
c010944b:	89 55 08             	mov    %edx,0x8(%ebp)
c010944e:	0f b6 00             	movzbl (%eax),%eax
c0109451:	84 c0                	test   %al,%al
c0109453:	75 e5                	jne    c010943a <strnlen+0x13>
    }
    return cnt;
c0109455:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
c0109458:	c9                   	leave  
c0109459:	c3                   	ret    

c010945a <strcpy>:
 * To avoid overflows, the size of array pointed by @dst should be long enough to
 * contain the same string as @src (including the terminating null character), and
 * should not overlap in memory with @src.
 * */
char *
strcpy(char *dst, const char *src) {
c010945a:	f3 0f 1e fb          	endbr32 
c010945e:	55                   	push   %ebp
c010945f:	89 e5                	mov    %esp,%ebp
c0109461:	57                   	push   %edi
c0109462:	56                   	push   %esi
c0109463:	83 ec 20             	sub    $0x20,%esp
c0109466:	8b 45 08             	mov    0x8(%ebp),%eax
c0109469:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010946c:	8b 45 0c             	mov    0xc(%ebp),%eax
c010946f:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRCPY
static inline char *
__strcpy(char *dst, const char *src) {
    int d0, d1, d2;
    asm volatile (
c0109472:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0109475:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109478:	89 d1                	mov    %edx,%ecx
c010947a:	89 c2                	mov    %eax,%edx
c010947c:	89 ce                	mov    %ecx,%esi
c010947e:	89 d7                	mov    %edx,%edi
c0109480:	ac                   	lods   %ds:(%esi),%al
c0109481:	aa                   	stos   %al,%es:(%edi)
c0109482:	84 c0                	test   %al,%al
c0109484:	75 fa                	jne    c0109480 <strcpy+0x26>
c0109486:	89 fa                	mov    %edi,%edx
c0109488:	89 f1                	mov    %esi,%ecx
c010948a:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c010948d:	89 55 e8             	mov    %edx,-0x18(%ebp)
c0109490:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        : "=&S" (d0), "=&D" (d1), "=&a" (d2)
        : "0" (src), "1" (dst) : "memory");
    return dst;
c0109493:	8b 45 f4             	mov    -0xc(%ebp),%eax
    char *p = dst;
    while ((*p ++ = *src ++) != '\0')
        /* nothing */;
    return dst;
#endif /* __HAVE_ARCH_STRCPY */
}
c0109496:	83 c4 20             	add    $0x20,%esp
c0109499:	5e                   	pop    %esi
c010949a:	5f                   	pop    %edi
c010949b:	5d                   	pop    %ebp
c010949c:	c3                   	ret    

c010949d <strncpy>:
 * @len:    maximum number of characters to be copied from @src
 *
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
c010949d:	f3 0f 1e fb          	endbr32 
c01094a1:	55                   	push   %ebp
c01094a2:	89 e5                	mov    %esp,%ebp
c01094a4:	83 ec 10             	sub    $0x10,%esp
    char *p = dst;
c01094a7:	8b 45 08             	mov    0x8(%ebp),%eax
c01094aa:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (len > 0) {
c01094ad:	eb 1e                	jmp    c01094cd <strncpy+0x30>
        if ((*p = *src) != '\0') {
c01094af:	8b 45 0c             	mov    0xc(%ebp),%eax
c01094b2:	0f b6 10             	movzbl (%eax),%edx
c01094b5:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01094b8:	88 10                	mov    %dl,(%eax)
c01094ba:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01094bd:	0f b6 00             	movzbl (%eax),%eax
c01094c0:	84 c0                	test   %al,%al
c01094c2:	74 03                	je     c01094c7 <strncpy+0x2a>
            src ++;
c01094c4:	ff 45 0c             	incl   0xc(%ebp)
        }
        p ++, len --;
c01094c7:	ff 45 fc             	incl   -0x4(%ebp)
c01094ca:	ff 4d 10             	decl   0x10(%ebp)
    while (len > 0) {
c01094cd:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c01094d1:	75 dc                	jne    c01094af <strncpy+0x12>
    }
    return dst;
c01094d3:	8b 45 08             	mov    0x8(%ebp),%eax
}
c01094d6:	c9                   	leave  
c01094d7:	c3                   	ret    

c01094d8 <strcmp>:
 * - A value greater than zero indicates that the first character that does
 *   not match has a greater value in @s1 than in @s2;
 * - And a value less than zero indicates the opposite.
 * */
int
strcmp(const char *s1, const char *s2) {
c01094d8:	f3 0f 1e fb          	endbr32 
c01094dc:	55                   	push   %ebp
c01094dd:	89 e5                	mov    %esp,%ebp
c01094df:	57                   	push   %edi
c01094e0:	56                   	push   %esi
c01094e1:	83 ec 20             	sub    $0x20,%esp
c01094e4:	8b 45 08             	mov    0x8(%ebp),%eax
c01094e7:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01094ea:	8b 45 0c             	mov    0xc(%ebp),%eax
c01094ed:	89 45 f0             	mov    %eax,-0x10(%ebp)
    asm volatile (
c01094f0:	8b 55 f4             	mov    -0xc(%ebp),%edx
c01094f3:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01094f6:	89 d1                	mov    %edx,%ecx
c01094f8:	89 c2                	mov    %eax,%edx
c01094fa:	89 ce                	mov    %ecx,%esi
c01094fc:	89 d7                	mov    %edx,%edi
c01094fe:	ac                   	lods   %ds:(%esi),%al
c01094ff:	ae                   	scas   %es:(%edi),%al
c0109500:	75 08                	jne    c010950a <strcmp+0x32>
c0109502:	84 c0                	test   %al,%al
c0109504:	75 f8                	jne    c01094fe <strcmp+0x26>
c0109506:	31 c0                	xor    %eax,%eax
c0109508:	eb 04                	jmp    c010950e <strcmp+0x36>
c010950a:	19 c0                	sbb    %eax,%eax
c010950c:	0c 01                	or     $0x1,%al
c010950e:	89 fa                	mov    %edi,%edx
c0109510:	89 f1                	mov    %esi,%ecx
c0109512:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109515:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c0109518:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return ret;
c010951b:	8b 45 ec             	mov    -0x14(%ebp),%eax
    while (*s1 != '\0' && *s1 == *s2) {
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
#endif /* __HAVE_ARCH_STRCMP */
}
c010951e:	83 c4 20             	add    $0x20,%esp
c0109521:	5e                   	pop    %esi
c0109522:	5f                   	pop    %edi
c0109523:	5d                   	pop    %ebp
c0109524:	c3                   	ret    

c0109525 <strncmp>:
 * they are equal to each other, it continues with the following pairs until
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
c0109525:	f3 0f 1e fb          	endbr32 
c0109529:	55                   	push   %ebp
c010952a:	89 e5                	mov    %esp,%ebp
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c010952c:	eb 09                	jmp    c0109537 <strncmp+0x12>
        n --, s1 ++, s2 ++;
c010952e:	ff 4d 10             	decl   0x10(%ebp)
c0109531:	ff 45 08             	incl   0x8(%ebp)
c0109534:	ff 45 0c             	incl   0xc(%ebp)
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
c0109537:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010953b:	74 1a                	je     c0109557 <strncmp+0x32>
c010953d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109540:	0f b6 00             	movzbl (%eax),%eax
c0109543:	84 c0                	test   %al,%al
c0109545:	74 10                	je     c0109557 <strncmp+0x32>
c0109547:	8b 45 08             	mov    0x8(%ebp),%eax
c010954a:	0f b6 10             	movzbl (%eax),%edx
c010954d:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109550:	0f b6 00             	movzbl (%eax),%eax
c0109553:	38 c2                	cmp    %al,%dl
c0109555:	74 d7                	je     c010952e <strncmp+0x9>
    }
    return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2);
c0109557:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010955b:	74 18                	je     c0109575 <strncmp+0x50>
c010955d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109560:	0f b6 00             	movzbl (%eax),%eax
c0109563:	0f b6 d0             	movzbl %al,%edx
c0109566:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109569:	0f b6 00             	movzbl (%eax),%eax
c010956c:	0f b6 c0             	movzbl %al,%eax
c010956f:	29 c2                	sub    %eax,%edx
c0109571:	89 d0                	mov    %edx,%eax
c0109573:	eb 05                	jmp    c010957a <strncmp+0x55>
c0109575:	b8 00 00 00 00       	mov    $0x0,%eax
}
c010957a:	5d                   	pop    %ebp
c010957b:	c3                   	ret    

c010957c <strchr>:
 *
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
c010957c:	f3 0f 1e fb          	endbr32 
c0109580:	55                   	push   %ebp
c0109581:	89 e5                	mov    %esp,%ebp
c0109583:	83 ec 04             	sub    $0x4,%esp
c0109586:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109589:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c010958c:	eb 13                	jmp    c01095a1 <strchr+0x25>
        if (*s == c) {
c010958e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109591:	0f b6 00             	movzbl (%eax),%eax
c0109594:	38 45 fc             	cmp    %al,-0x4(%ebp)
c0109597:	75 05                	jne    c010959e <strchr+0x22>
            return (char *)s;
c0109599:	8b 45 08             	mov    0x8(%ebp),%eax
c010959c:	eb 12                	jmp    c01095b0 <strchr+0x34>
        }
        s ++;
c010959e:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
c01095a1:	8b 45 08             	mov    0x8(%ebp),%eax
c01095a4:	0f b6 00             	movzbl (%eax),%eax
c01095a7:	84 c0                	test   %al,%al
c01095a9:	75 e3                	jne    c010958e <strchr+0x12>
    }
    return NULL;
c01095ab:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01095b0:	c9                   	leave  
c01095b1:	c3                   	ret    

c01095b2 <strfind>:
 * The strfind() function is like strchr() except that if @c is
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
c01095b2:	f3 0f 1e fb          	endbr32 
c01095b6:	55                   	push   %ebp
c01095b7:	89 e5                	mov    %esp,%ebp
c01095b9:	83 ec 04             	sub    $0x4,%esp
c01095bc:	8b 45 0c             	mov    0xc(%ebp),%eax
c01095bf:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
c01095c2:	eb 0e                	jmp    c01095d2 <strfind+0x20>
        if (*s == c) {
c01095c4:	8b 45 08             	mov    0x8(%ebp),%eax
c01095c7:	0f b6 00             	movzbl (%eax),%eax
c01095ca:	38 45 fc             	cmp    %al,-0x4(%ebp)
c01095cd:	74 0f                	je     c01095de <strfind+0x2c>
            break;
        }
        s ++;
c01095cf:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
c01095d2:	8b 45 08             	mov    0x8(%ebp),%eax
c01095d5:	0f b6 00             	movzbl (%eax),%eax
c01095d8:	84 c0                	test   %al,%al
c01095da:	75 e8                	jne    c01095c4 <strfind+0x12>
c01095dc:	eb 01                	jmp    c01095df <strfind+0x2d>
            break;
c01095de:	90                   	nop
    }
    return (char *)s;
c01095df:	8b 45 08             	mov    0x8(%ebp),%eax
}
c01095e2:	c9                   	leave  
c01095e3:	c3                   	ret    

c01095e4 <strtol>:
 * an optional "0x" or "0X" prefix.
 *
 * The strtol() function returns the converted integral number as a long int value.
 * */
long
strtol(const char *s, char **endptr, int base) {
c01095e4:	f3 0f 1e fb          	endbr32 
c01095e8:	55                   	push   %ebp
c01095e9:	89 e5                	mov    %esp,%ebp
c01095eb:	83 ec 10             	sub    $0x10,%esp
    int neg = 0;
c01095ee:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    long val = 0;
c01095f5:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
c01095fc:	eb 03                	jmp    c0109601 <strtol+0x1d>
        s ++;
c01095fe:	ff 45 08             	incl   0x8(%ebp)
    while (*s == ' ' || *s == '\t') {
c0109601:	8b 45 08             	mov    0x8(%ebp),%eax
c0109604:	0f b6 00             	movzbl (%eax),%eax
c0109607:	3c 20                	cmp    $0x20,%al
c0109609:	74 f3                	je     c01095fe <strtol+0x1a>
c010960b:	8b 45 08             	mov    0x8(%ebp),%eax
c010960e:	0f b6 00             	movzbl (%eax),%eax
c0109611:	3c 09                	cmp    $0x9,%al
c0109613:	74 e9                	je     c01095fe <strtol+0x1a>
    }

    // plus/minus sign
    if (*s == '+') {
c0109615:	8b 45 08             	mov    0x8(%ebp),%eax
c0109618:	0f b6 00             	movzbl (%eax),%eax
c010961b:	3c 2b                	cmp    $0x2b,%al
c010961d:	75 05                	jne    c0109624 <strtol+0x40>
        s ++;
c010961f:	ff 45 08             	incl   0x8(%ebp)
c0109622:	eb 14                	jmp    c0109638 <strtol+0x54>
    }
    else if (*s == '-') {
c0109624:	8b 45 08             	mov    0x8(%ebp),%eax
c0109627:	0f b6 00             	movzbl (%eax),%eax
c010962a:	3c 2d                	cmp    $0x2d,%al
c010962c:	75 0a                	jne    c0109638 <strtol+0x54>
        s ++, neg = 1;
c010962e:	ff 45 08             	incl   0x8(%ebp)
c0109631:	c7 45 fc 01 00 00 00 	movl   $0x1,-0x4(%ebp)
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
c0109638:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010963c:	74 06                	je     c0109644 <strtol+0x60>
c010963e:	83 7d 10 10          	cmpl   $0x10,0x10(%ebp)
c0109642:	75 22                	jne    c0109666 <strtol+0x82>
c0109644:	8b 45 08             	mov    0x8(%ebp),%eax
c0109647:	0f b6 00             	movzbl (%eax),%eax
c010964a:	3c 30                	cmp    $0x30,%al
c010964c:	75 18                	jne    c0109666 <strtol+0x82>
c010964e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109651:	40                   	inc    %eax
c0109652:	0f b6 00             	movzbl (%eax),%eax
c0109655:	3c 78                	cmp    $0x78,%al
c0109657:	75 0d                	jne    c0109666 <strtol+0x82>
        s += 2, base = 16;
c0109659:	83 45 08 02          	addl   $0x2,0x8(%ebp)
c010965d:	c7 45 10 10 00 00 00 	movl   $0x10,0x10(%ebp)
c0109664:	eb 29                	jmp    c010968f <strtol+0xab>
    }
    else if (base == 0 && s[0] == '0') {
c0109666:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c010966a:	75 16                	jne    c0109682 <strtol+0x9e>
c010966c:	8b 45 08             	mov    0x8(%ebp),%eax
c010966f:	0f b6 00             	movzbl (%eax),%eax
c0109672:	3c 30                	cmp    $0x30,%al
c0109674:	75 0c                	jne    c0109682 <strtol+0x9e>
        s ++, base = 8;
c0109676:	ff 45 08             	incl   0x8(%ebp)
c0109679:	c7 45 10 08 00 00 00 	movl   $0x8,0x10(%ebp)
c0109680:	eb 0d                	jmp    c010968f <strtol+0xab>
    }
    else if (base == 0) {
c0109682:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
c0109686:	75 07                	jne    c010968f <strtol+0xab>
        base = 10;
c0109688:	c7 45 10 0a 00 00 00 	movl   $0xa,0x10(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
c010968f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109692:	0f b6 00             	movzbl (%eax),%eax
c0109695:	3c 2f                	cmp    $0x2f,%al
c0109697:	7e 1b                	jle    c01096b4 <strtol+0xd0>
c0109699:	8b 45 08             	mov    0x8(%ebp),%eax
c010969c:	0f b6 00             	movzbl (%eax),%eax
c010969f:	3c 39                	cmp    $0x39,%al
c01096a1:	7f 11                	jg     c01096b4 <strtol+0xd0>
            dig = *s - '0';
c01096a3:	8b 45 08             	mov    0x8(%ebp),%eax
c01096a6:	0f b6 00             	movzbl (%eax),%eax
c01096a9:	0f be c0             	movsbl %al,%eax
c01096ac:	83 e8 30             	sub    $0x30,%eax
c01096af:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01096b2:	eb 48                	jmp    c01096fc <strtol+0x118>
        }
        else if (*s >= 'a' && *s <= 'z') {
c01096b4:	8b 45 08             	mov    0x8(%ebp),%eax
c01096b7:	0f b6 00             	movzbl (%eax),%eax
c01096ba:	3c 60                	cmp    $0x60,%al
c01096bc:	7e 1b                	jle    c01096d9 <strtol+0xf5>
c01096be:	8b 45 08             	mov    0x8(%ebp),%eax
c01096c1:	0f b6 00             	movzbl (%eax),%eax
c01096c4:	3c 7a                	cmp    $0x7a,%al
c01096c6:	7f 11                	jg     c01096d9 <strtol+0xf5>
            dig = *s - 'a' + 10;
c01096c8:	8b 45 08             	mov    0x8(%ebp),%eax
c01096cb:	0f b6 00             	movzbl (%eax),%eax
c01096ce:	0f be c0             	movsbl %al,%eax
c01096d1:	83 e8 57             	sub    $0x57,%eax
c01096d4:	89 45 f4             	mov    %eax,-0xc(%ebp)
c01096d7:	eb 23                	jmp    c01096fc <strtol+0x118>
        }
        else if (*s >= 'A' && *s <= 'Z') {
c01096d9:	8b 45 08             	mov    0x8(%ebp),%eax
c01096dc:	0f b6 00             	movzbl (%eax),%eax
c01096df:	3c 40                	cmp    $0x40,%al
c01096e1:	7e 3b                	jle    c010971e <strtol+0x13a>
c01096e3:	8b 45 08             	mov    0x8(%ebp),%eax
c01096e6:	0f b6 00             	movzbl (%eax),%eax
c01096e9:	3c 5a                	cmp    $0x5a,%al
c01096eb:	7f 31                	jg     c010971e <strtol+0x13a>
            dig = *s - 'A' + 10;
c01096ed:	8b 45 08             	mov    0x8(%ebp),%eax
c01096f0:	0f b6 00             	movzbl (%eax),%eax
c01096f3:	0f be c0             	movsbl %al,%eax
c01096f6:	83 e8 37             	sub    $0x37,%eax
c01096f9:	89 45 f4             	mov    %eax,-0xc(%ebp)
        }
        else {
            break;
        }
        if (dig >= base) {
c01096fc:	8b 45 f4             	mov    -0xc(%ebp),%eax
c01096ff:	3b 45 10             	cmp    0x10(%ebp),%eax
c0109702:	7d 19                	jge    c010971d <strtol+0x139>
            break;
        }
        s ++, val = (val * base) + dig;
c0109704:	ff 45 08             	incl   0x8(%ebp)
c0109707:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010970a:	0f af 45 10          	imul   0x10(%ebp),%eax
c010970e:	89 c2                	mov    %eax,%edx
c0109710:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109713:	01 d0                	add    %edx,%eax
c0109715:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (1) {
c0109718:	e9 72 ff ff ff       	jmp    c010968f <strtol+0xab>
            break;
c010971d:	90                   	nop
        // we don't properly detect overflow!
    }

    if (endptr) {
c010971e:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0109722:	74 08                	je     c010972c <strtol+0x148>
        *endptr = (char *) s;
c0109724:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109727:	8b 55 08             	mov    0x8(%ebp),%edx
c010972a:	89 10                	mov    %edx,(%eax)
    }
    return (neg ? -val : val);
c010972c:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
c0109730:	74 07                	je     c0109739 <strtol+0x155>
c0109732:	8b 45 f8             	mov    -0x8(%ebp),%eax
c0109735:	f7 d8                	neg    %eax
c0109737:	eb 03                	jmp    c010973c <strtol+0x158>
c0109739:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
c010973c:	c9                   	leave  
c010973d:	c3                   	ret    

c010973e <memset>:
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
c010973e:	f3 0f 1e fb          	endbr32 
c0109742:	55                   	push   %ebp
c0109743:	89 e5                	mov    %esp,%ebp
c0109745:	57                   	push   %edi
c0109746:	83 ec 24             	sub    $0x24,%esp
c0109749:	8b 45 0c             	mov    0xc(%ebp),%eax
c010974c:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
c010974f:	0f be 55 d8          	movsbl -0x28(%ebp),%edx
c0109753:	8b 45 08             	mov    0x8(%ebp),%eax
c0109756:	89 45 f8             	mov    %eax,-0x8(%ebp)
c0109759:	88 55 f7             	mov    %dl,-0x9(%ebp)
c010975c:	8b 45 10             	mov    0x10(%ebp),%eax
c010975f:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
    int d0, d1;
    asm volatile (
c0109762:	8b 4d f0             	mov    -0x10(%ebp),%ecx
c0109765:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
c0109769:	8b 55 f8             	mov    -0x8(%ebp),%edx
c010976c:	89 d7                	mov    %edx,%edi
c010976e:	f3 aa                	rep stos %al,%es:(%edi)
c0109770:	89 fa                	mov    %edi,%edx
c0109772:	89 4d ec             	mov    %ecx,-0x14(%ebp)
c0109775:	89 55 e8             	mov    %edx,-0x18(%ebp)
        "rep; stosb;"
        : "=&c" (d0), "=&D" (d1)
        : "0" (n), "a" (c), "1" (s)
        : "memory");
    return s;
c0109778:	8b 45 f8             	mov    -0x8(%ebp),%eax
    while (n -- > 0) {
        *p ++ = c;
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
c010977b:	83 c4 24             	add    $0x24,%esp
c010977e:	5f                   	pop    %edi
c010977f:	5d                   	pop    %ebp
c0109780:	c3                   	ret    

c0109781 <memmove>:
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
c0109781:	f3 0f 1e fb          	endbr32 
c0109785:	55                   	push   %ebp
c0109786:	89 e5                	mov    %esp,%ebp
c0109788:	57                   	push   %edi
c0109789:	56                   	push   %esi
c010978a:	53                   	push   %ebx
c010978b:	83 ec 30             	sub    $0x30,%esp
c010978e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109791:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109794:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109797:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010979a:	8b 45 10             	mov    0x10(%ebp),%eax
c010979d:	89 45 e8             	mov    %eax,-0x18(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
c01097a0:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01097a3:	3b 45 ec             	cmp    -0x14(%ebp),%eax
c01097a6:	73 42                	jae    c01097ea <memmove+0x69>
c01097a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01097ab:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01097ae:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01097b1:	89 45 e0             	mov    %eax,-0x20(%ebp)
c01097b4:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01097b7:	89 45 dc             	mov    %eax,-0x24(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c01097ba:	8b 45 dc             	mov    -0x24(%ebp),%eax
c01097bd:	c1 e8 02             	shr    $0x2,%eax
c01097c0:	89 c1                	mov    %eax,%ecx
    asm volatile (
c01097c2:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c01097c5:	8b 45 e0             	mov    -0x20(%ebp),%eax
c01097c8:	89 d7                	mov    %edx,%edi
c01097ca:	89 c6                	mov    %eax,%esi
c01097cc:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c01097ce:	8b 4d dc             	mov    -0x24(%ebp),%ecx
c01097d1:	83 e1 03             	and    $0x3,%ecx
c01097d4:	74 02                	je     c01097d8 <memmove+0x57>
c01097d6:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c01097d8:	89 f0                	mov    %esi,%eax
c01097da:	89 fa                	mov    %edi,%edx
c01097dc:	89 4d d8             	mov    %ecx,-0x28(%ebp)
c01097df:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c01097e2:	89 45 d0             	mov    %eax,-0x30(%ebp)
        : "memory");
    return dst;
c01097e5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
        return __memcpy(dst, src, n);
c01097e8:	eb 36                	jmp    c0109820 <memmove+0x9f>
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
c01097ea:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01097ed:	8d 50 ff             	lea    -0x1(%eax),%edx
c01097f0:	8b 45 ec             	mov    -0x14(%ebp),%eax
c01097f3:	01 c2                	add    %eax,%edx
c01097f5:	8b 45 e8             	mov    -0x18(%ebp),%eax
c01097f8:	8d 48 ff             	lea    -0x1(%eax),%ecx
c01097fb:	8b 45 f0             	mov    -0x10(%ebp),%eax
c01097fe:	8d 1c 01             	lea    (%ecx,%eax,1),%ebx
    asm volatile (
c0109801:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109804:	89 c1                	mov    %eax,%ecx
c0109806:	89 d8                	mov    %ebx,%eax
c0109808:	89 d6                	mov    %edx,%esi
c010980a:	89 c7                	mov    %eax,%edi
c010980c:	fd                   	std    
c010980d:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c010980f:	fc                   	cld    
c0109810:	89 f8                	mov    %edi,%eax
c0109812:	89 f2                	mov    %esi,%edx
c0109814:	89 4d cc             	mov    %ecx,-0x34(%ebp)
c0109817:	89 55 c8             	mov    %edx,-0x38(%ebp)
c010981a:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    return dst;
c010981d:	8b 45 f0             	mov    -0x10(%ebp),%eax
            *d ++ = *s ++;
        }
    }
    return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
c0109820:	83 c4 30             	add    $0x30,%esp
c0109823:	5b                   	pop    %ebx
c0109824:	5e                   	pop    %esi
c0109825:	5f                   	pop    %edi
c0109826:	5d                   	pop    %ebp
c0109827:	c3                   	ret    

c0109828 <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
c0109828:	f3 0f 1e fb          	endbr32 
c010982c:	55                   	push   %ebp
c010982d:	89 e5                	mov    %esp,%ebp
c010982f:	57                   	push   %edi
c0109830:	56                   	push   %esi
c0109831:	83 ec 20             	sub    $0x20,%esp
c0109834:	8b 45 08             	mov    0x8(%ebp),%eax
c0109837:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010983a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010983d:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109840:	8b 45 10             	mov    0x10(%ebp),%eax
c0109843:	89 45 ec             	mov    %eax,-0x14(%ebp)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
c0109846:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109849:	c1 e8 02             	shr    $0x2,%eax
c010984c:	89 c1                	mov    %eax,%ecx
    asm volatile (
c010984e:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109851:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109854:	89 d7                	mov    %edx,%edi
c0109856:	89 c6                	mov    %eax,%esi
c0109858:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
c010985a:	8b 4d ec             	mov    -0x14(%ebp),%ecx
c010985d:	83 e1 03             	and    $0x3,%ecx
c0109860:	74 02                	je     c0109864 <memcpy+0x3c>
c0109862:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
c0109864:	89 f0                	mov    %esi,%eax
c0109866:	89 fa                	mov    %edi,%edx
c0109868:	89 4d e8             	mov    %ecx,-0x18(%ebp)
c010986b:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c010986e:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return dst;
c0109871:	8b 45 f4             	mov    -0xc(%ebp),%eax
    while (n -- > 0) {
        *d ++ = *s ++;
    }
    return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
c0109874:	83 c4 20             	add    $0x20,%esp
c0109877:	5e                   	pop    %esi
c0109878:	5f                   	pop    %edi
c0109879:	5d                   	pop    %ebp
c010987a:	c3                   	ret    

c010987b <memcmp>:
 *   match in both memory blocks has a greater value in @v1 than in @v2
 *   as if evaluated as unsigned char values;
 * - And a value less than zero indicates the opposite.
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
c010987b:	f3 0f 1e fb          	endbr32 
c010987f:	55                   	push   %ebp
c0109880:	89 e5                	mov    %esp,%ebp
c0109882:	83 ec 10             	sub    $0x10,%esp
    const char *s1 = (const char *)v1;
c0109885:	8b 45 08             	mov    0x8(%ebp),%eax
c0109888:	89 45 fc             	mov    %eax,-0x4(%ebp)
    const char *s2 = (const char *)v2;
c010988b:	8b 45 0c             	mov    0xc(%ebp),%eax
c010988e:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (n -- > 0) {
c0109891:	eb 2e                	jmp    c01098c1 <memcmp+0x46>
        if (*s1 != *s2) {
c0109893:	8b 45 fc             	mov    -0x4(%ebp),%eax
c0109896:	0f b6 10             	movzbl (%eax),%edx
c0109899:	8b 45 f8             	mov    -0x8(%ebp),%eax
c010989c:	0f b6 00             	movzbl (%eax),%eax
c010989f:	38 c2                	cmp    %al,%dl
c01098a1:	74 18                	je     c01098bb <memcmp+0x40>
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
c01098a3:	8b 45 fc             	mov    -0x4(%ebp),%eax
c01098a6:	0f b6 00             	movzbl (%eax),%eax
c01098a9:	0f b6 d0             	movzbl %al,%edx
c01098ac:	8b 45 f8             	mov    -0x8(%ebp),%eax
c01098af:	0f b6 00             	movzbl (%eax),%eax
c01098b2:	0f b6 c0             	movzbl %al,%eax
c01098b5:	29 c2                	sub    %eax,%edx
c01098b7:	89 d0                	mov    %edx,%eax
c01098b9:	eb 18                	jmp    c01098d3 <memcmp+0x58>
        }
        s1 ++, s2 ++;
c01098bb:	ff 45 fc             	incl   -0x4(%ebp)
c01098be:	ff 45 f8             	incl   -0x8(%ebp)
    while (n -- > 0) {
c01098c1:	8b 45 10             	mov    0x10(%ebp),%eax
c01098c4:	8d 50 ff             	lea    -0x1(%eax),%edx
c01098c7:	89 55 10             	mov    %edx,0x10(%ebp)
c01098ca:	85 c0                	test   %eax,%eax
c01098cc:	75 c5                	jne    c0109893 <memcmp+0x18>
    }
    return 0;
c01098ce:	b8 00 00 00 00       	mov    $0x0,%eax
}
c01098d3:	c9                   	leave  
c01098d4:	c3                   	ret    

c01098d5 <printnum>:
 * @width:      maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:       character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
c01098d5:	f3 0f 1e fb          	endbr32 
c01098d9:	55                   	push   %ebp
c01098da:	89 e5                	mov    %esp,%ebp
c01098dc:	83 ec 58             	sub    $0x58,%esp
c01098df:	8b 45 10             	mov    0x10(%ebp),%eax
c01098e2:	89 45 d0             	mov    %eax,-0x30(%ebp)
c01098e5:	8b 45 14             	mov    0x14(%ebp),%eax
c01098e8:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    unsigned long long result = num;
c01098eb:	8b 45 d0             	mov    -0x30(%ebp),%eax
c01098ee:	8b 55 d4             	mov    -0x2c(%ebp),%edx
c01098f1:	89 45 e8             	mov    %eax,-0x18(%ebp)
c01098f4:	89 55 ec             	mov    %edx,-0x14(%ebp)
    unsigned mod = do_div(result, base);
c01098f7:	8b 45 18             	mov    0x18(%ebp),%eax
c01098fa:	89 45 e4             	mov    %eax,-0x1c(%ebp)
c01098fd:	8b 45 e8             	mov    -0x18(%ebp),%eax
c0109900:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109903:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0109906:	89 55 f0             	mov    %edx,-0x10(%ebp)
c0109909:	8b 45 f0             	mov    -0x10(%ebp),%eax
c010990c:	89 45 f4             	mov    %eax,-0xc(%ebp)
c010990f:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
c0109913:	74 1c                	je     c0109931 <printnum+0x5c>
c0109915:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109918:	ba 00 00 00 00       	mov    $0x0,%edx
c010991d:	f7 75 e4             	divl   -0x1c(%ebp)
c0109920:	89 55 f4             	mov    %edx,-0xc(%ebp)
c0109923:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109926:	ba 00 00 00 00       	mov    $0x0,%edx
c010992b:	f7 75 e4             	divl   -0x1c(%ebp)
c010992e:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109931:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109934:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109937:	f7 75 e4             	divl   -0x1c(%ebp)
c010993a:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010993d:	89 55 dc             	mov    %edx,-0x24(%ebp)
c0109940:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109943:	8b 55 f0             	mov    -0x10(%ebp),%edx
c0109946:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109949:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010994c:	8b 45 dc             	mov    -0x24(%ebp),%eax
c010994f:	89 45 d8             	mov    %eax,-0x28(%ebp)

    // first recursively print all preceding (more significant) digits
    if (num >= base) {
c0109952:	8b 45 18             	mov    0x18(%ebp),%eax
c0109955:	ba 00 00 00 00       	mov    $0x0,%edx
c010995a:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
c010995d:	39 45 d0             	cmp    %eax,-0x30(%ebp)
c0109960:	19 d1                	sbb    %edx,%ecx
c0109962:	72 4c                	jb     c01099b0 <printnum+0xdb>
        printnum(putch, putdat, result, base, width - 1, padc);
c0109964:	8b 45 1c             	mov    0x1c(%ebp),%eax
c0109967:	8d 50 ff             	lea    -0x1(%eax),%edx
c010996a:	8b 45 20             	mov    0x20(%ebp),%eax
c010996d:	89 44 24 18          	mov    %eax,0x18(%esp)
c0109971:	89 54 24 14          	mov    %edx,0x14(%esp)
c0109975:	8b 45 18             	mov    0x18(%ebp),%eax
c0109978:	89 44 24 10          	mov    %eax,0x10(%esp)
c010997c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010997f:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109982:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109986:	89 54 24 0c          	mov    %edx,0xc(%esp)
c010998a:	8b 45 0c             	mov    0xc(%ebp),%eax
c010998d:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109991:	8b 45 08             	mov    0x8(%ebp),%eax
c0109994:	89 04 24             	mov    %eax,(%esp)
c0109997:	e8 39 ff ff ff       	call   c01098d5 <printnum>
c010999c:	eb 1b                	jmp    c01099b9 <printnum+0xe4>
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
            putch(padc, putdat);
c010999e:	8b 45 0c             	mov    0xc(%ebp),%eax
c01099a1:	89 44 24 04          	mov    %eax,0x4(%esp)
c01099a5:	8b 45 20             	mov    0x20(%ebp),%eax
c01099a8:	89 04 24             	mov    %eax,(%esp)
c01099ab:	8b 45 08             	mov    0x8(%ebp),%eax
c01099ae:	ff d0                	call   *%eax
        while (-- width > 0)
c01099b0:	ff 4d 1c             	decl   0x1c(%ebp)
c01099b3:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
c01099b7:	7f e5                	jg     c010999e <printnum+0xc9>
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat);
c01099b9:	8b 45 d8             	mov    -0x28(%ebp),%eax
c01099bc:	05 5c c2 10 c0       	add    $0xc010c25c,%eax
c01099c1:	0f b6 00             	movzbl (%eax),%eax
c01099c4:	0f be c0             	movsbl %al,%eax
c01099c7:	8b 55 0c             	mov    0xc(%ebp),%edx
c01099ca:	89 54 24 04          	mov    %edx,0x4(%esp)
c01099ce:	89 04 24             	mov    %eax,(%esp)
c01099d1:	8b 45 08             	mov    0x8(%ebp),%eax
c01099d4:	ff d0                	call   *%eax
}
c01099d6:	90                   	nop
c01099d7:	c9                   	leave  
c01099d8:	c3                   	ret    

c01099d9 <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
c01099d9:	f3 0f 1e fb          	endbr32 
c01099dd:	55                   	push   %ebp
c01099de:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c01099e0:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c01099e4:	7e 14                	jle    c01099fa <getuint+0x21>
        return va_arg(*ap, unsigned long long);
c01099e6:	8b 45 08             	mov    0x8(%ebp),%eax
c01099e9:	8b 00                	mov    (%eax),%eax
c01099eb:	8d 48 08             	lea    0x8(%eax),%ecx
c01099ee:	8b 55 08             	mov    0x8(%ebp),%edx
c01099f1:	89 0a                	mov    %ecx,(%edx)
c01099f3:	8b 50 04             	mov    0x4(%eax),%edx
c01099f6:	8b 00                	mov    (%eax),%eax
c01099f8:	eb 30                	jmp    c0109a2a <getuint+0x51>
    }
    else if (lflag) {
c01099fa:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c01099fe:	74 16                	je     c0109a16 <getuint+0x3d>
        return va_arg(*ap, unsigned long);
c0109a00:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a03:	8b 00                	mov    (%eax),%eax
c0109a05:	8d 48 04             	lea    0x4(%eax),%ecx
c0109a08:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a0b:	89 0a                	mov    %ecx,(%edx)
c0109a0d:	8b 00                	mov    (%eax),%eax
c0109a0f:	ba 00 00 00 00       	mov    $0x0,%edx
c0109a14:	eb 14                	jmp    c0109a2a <getuint+0x51>
    }
    else {
        return va_arg(*ap, unsigned int);
c0109a16:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a19:	8b 00                	mov    (%eax),%eax
c0109a1b:	8d 48 04             	lea    0x4(%eax),%ecx
c0109a1e:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a21:	89 0a                	mov    %ecx,(%edx)
c0109a23:	8b 00                	mov    (%eax),%eax
c0109a25:	ba 00 00 00 00       	mov    $0x0,%edx
    }
}
c0109a2a:	5d                   	pop    %ebp
c0109a2b:	c3                   	ret    

c0109a2c <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
c0109a2c:	f3 0f 1e fb          	endbr32 
c0109a30:	55                   	push   %ebp
c0109a31:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
c0109a33:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
c0109a37:	7e 14                	jle    c0109a4d <getint+0x21>
        return va_arg(*ap, long long);
c0109a39:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a3c:	8b 00                	mov    (%eax),%eax
c0109a3e:	8d 48 08             	lea    0x8(%eax),%ecx
c0109a41:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a44:	89 0a                	mov    %ecx,(%edx)
c0109a46:	8b 50 04             	mov    0x4(%eax),%edx
c0109a49:	8b 00                	mov    (%eax),%eax
c0109a4b:	eb 28                	jmp    c0109a75 <getint+0x49>
    }
    else if (lflag) {
c0109a4d:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
c0109a51:	74 12                	je     c0109a65 <getint+0x39>
        return va_arg(*ap, long);
c0109a53:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a56:	8b 00                	mov    (%eax),%eax
c0109a58:	8d 48 04             	lea    0x4(%eax),%ecx
c0109a5b:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a5e:	89 0a                	mov    %ecx,(%edx)
c0109a60:	8b 00                	mov    (%eax),%eax
c0109a62:	99                   	cltd   
c0109a63:	eb 10                	jmp    c0109a75 <getint+0x49>
    }
    else {
        return va_arg(*ap, int);
c0109a65:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a68:	8b 00                	mov    (%eax),%eax
c0109a6a:	8d 48 04             	lea    0x4(%eax),%ecx
c0109a6d:	8b 55 08             	mov    0x8(%ebp),%edx
c0109a70:	89 0a                	mov    %ecx,(%edx)
c0109a72:	8b 00                	mov    (%eax),%eax
c0109a74:	99                   	cltd   
    }
}
c0109a75:	5d                   	pop    %ebp
c0109a76:	c3                   	ret    

c0109a77 <printfmt>:
 * @putch:      specified putch function, print a single character
 * @putdat:     used by @putch function
 * @fmt:        the format string to use
 * */
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
c0109a77:	f3 0f 1e fb          	endbr32 
c0109a7b:	55                   	push   %ebp
c0109a7c:	89 e5                	mov    %esp,%ebp
c0109a7e:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
c0109a81:	8d 45 14             	lea    0x14(%ebp),%eax
c0109a84:	89 45 f4             	mov    %eax,-0xc(%ebp)
    vprintfmt(putch, putdat, fmt, ap);
c0109a87:	8b 45 f4             	mov    -0xc(%ebp),%eax
c0109a8a:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109a8e:	8b 45 10             	mov    0x10(%ebp),%eax
c0109a91:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109a95:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109a98:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109a9c:	8b 45 08             	mov    0x8(%ebp),%eax
c0109a9f:	89 04 24             	mov    %eax,(%esp)
c0109aa2:	e8 03 00 00 00       	call   c0109aaa <vprintfmt>
    va_end(ap);
}
c0109aa7:	90                   	nop
c0109aa8:	c9                   	leave  
c0109aa9:	c3                   	ret    

c0109aaa <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
c0109aaa:	f3 0f 1e fb          	endbr32 
c0109aae:	55                   	push   %ebp
c0109aaf:	89 e5                	mov    %esp,%ebp
c0109ab1:	56                   	push   %esi
c0109ab2:	53                   	push   %ebx
c0109ab3:	83 ec 40             	sub    $0x40,%esp
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c0109ab6:	eb 17                	jmp    c0109acf <vprintfmt+0x25>
            if (ch == '\0') {
c0109ab8:	85 db                	test   %ebx,%ebx
c0109aba:	0f 84 c0 03 00 00    	je     c0109e80 <vprintfmt+0x3d6>
                return;
            }
            putch(ch, putdat);
c0109ac0:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109ac3:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109ac7:	89 1c 24             	mov    %ebx,(%esp)
c0109aca:	8b 45 08             	mov    0x8(%ebp),%eax
c0109acd:	ff d0                	call   *%eax
        while ((ch = *(unsigned char *)fmt ++) != '%') {
c0109acf:	8b 45 10             	mov    0x10(%ebp),%eax
c0109ad2:	8d 50 01             	lea    0x1(%eax),%edx
c0109ad5:	89 55 10             	mov    %edx,0x10(%ebp)
c0109ad8:	0f b6 00             	movzbl (%eax),%eax
c0109adb:	0f b6 d8             	movzbl %al,%ebx
c0109ade:	83 fb 25             	cmp    $0x25,%ebx
c0109ae1:	75 d5                	jne    c0109ab8 <vprintfmt+0xe>
        }

        // Process a %-escape sequence
        char padc = ' ';
c0109ae3:	c6 45 db 20          	movb   $0x20,-0x25(%ebp)
        width = precision = -1;
c0109ae7:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
c0109aee:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109af1:	89 45 e8             	mov    %eax,-0x18(%ebp)
        lflag = altflag = 0;
c0109af4:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
c0109afb:	8b 45 dc             	mov    -0x24(%ebp),%eax
c0109afe:	89 45 e0             	mov    %eax,-0x20(%ebp)

    reswitch:
        switch (ch = *(unsigned char *)fmt ++) {
c0109b01:	8b 45 10             	mov    0x10(%ebp),%eax
c0109b04:	8d 50 01             	lea    0x1(%eax),%edx
c0109b07:	89 55 10             	mov    %edx,0x10(%ebp)
c0109b0a:	0f b6 00             	movzbl (%eax),%eax
c0109b0d:	0f b6 d8             	movzbl %al,%ebx
c0109b10:	8d 43 dd             	lea    -0x23(%ebx),%eax
c0109b13:	83 f8 55             	cmp    $0x55,%eax
c0109b16:	0f 87 38 03 00 00    	ja     c0109e54 <vprintfmt+0x3aa>
c0109b1c:	8b 04 85 80 c2 10 c0 	mov    -0x3fef3d80(,%eax,4),%eax
c0109b23:	3e ff e0             	notrack jmp *%eax

        // flag to pad on the right
        case '-':
            padc = '-';
c0109b26:	c6 45 db 2d          	movb   $0x2d,-0x25(%ebp)
            goto reswitch;
c0109b2a:	eb d5                	jmp    c0109b01 <vprintfmt+0x57>

        // flag to pad with 0's instead of spaces
        case '0':
            padc = '0';
c0109b2c:	c6 45 db 30          	movb   $0x30,-0x25(%ebp)
            goto reswitch;
c0109b30:	eb cf                	jmp    c0109b01 <vprintfmt+0x57>

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
c0109b32:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
                precision = precision * 10 + ch - '0';
c0109b39:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109b3c:	89 d0                	mov    %edx,%eax
c0109b3e:	c1 e0 02             	shl    $0x2,%eax
c0109b41:	01 d0                	add    %edx,%eax
c0109b43:	01 c0                	add    %eax,%eax
c0109b45:	01 d8                	add    %ebx,%eax
c0109b47:	83 e8 30             	sub    $0x30,%eax
c0109b4a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
                ch = *fmt;
c0109b4d:	8b 45 10             	mov    0x10(%ebp),%eax
c0109b50:	0f b6 00             	movzbl (%eax),%eax
c0109b53:	0f be d8             	movsbl %al,%ebx
                if (ch < '0' || ch > '9') {
c0109b56:	83 fb 2f             	cmp    $0x2f,%ebx
c0109b59:	7e 38                	jle    c0109b93 <vprintfmt+0xe9>
c0109b5b:	83 fb 39             	cmp    $0x39,%ebx
c0109b5e:	7f 33                	jg     c0109b93 <vprintfmt+0xe9>
            for (precision = 0; ; ++ fmt) {
c0109b60:	ff 45 10             	incl   0x10(%ebp)
                precision = precision * 10 + ch - '0';
c0109b63:	eb d4                	jmp    c0109b39 <vprintfmt+0x8f>
                }
            }
            goto process_precision;

        case '*':
            precision = va_arg(ap, int);
c0109b65:	8b 45 14             	mov    0x14(%ebp),%eax
c0109b68:	8d 50 04             	lea    0x4(%eax),%edx
c0109b6b:	89 55 14             	mov    %edx,0x14(%ebp)
c0109b6e:	8b 00                	mov    (%eax),%eax
c0109b70:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            goto process_precision;
c0109b73:	eb 1f                	jmp    c0109b94 <vprintfmt+0xea>

        case '.':
            if (width < 0)
c0109b75:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109b79:	79 86                	jns    c0109b01 <vprintfmt+0x57>
                width = 0;
c0109b7b:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
            goto reswitch;
c0109b82:	e9 7a ff ff ff       	jmp    c0109b01 <vprintfmt+0x57>

        case '#':
            altflag = 1;
c0109b87:	c7 45 dc 01 00 00 00 	movl   $0x1,-0x24(%ebp)
            goto reswitch;
c0109b8e:	e9 6e ff ff ff       	jmp    c0109b01 <vprintfmt+0x57>
            goto process_precision;
c0109b93:	90                   	nop

        process_precision:
            if (width < 0)
c0109b94:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109b98:	0f 89 63 ff ff ff    	jns    c0109b01 <vprintfmt+0x57>
                width = precision, precision = -1;
c0109b9e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109ba1:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109ba4:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
            goto reswitch;
c0109bab:	e9 51 ff ff ff       	jmp    c0109b01 <vprintfmt+0x57>

        // long flag (doubled for long long)
        case 'l':
            lflag ++;
c0109bb0:	ff 45 e0             	incl   -0x20(%ebp)
            goto reswitch;
c0109bb3:	e9 49 ff ff ff       	jmp    c0109b01 <vprintfmt+0x57>

        // character
        case 'c':
            putch(va_arg(ap, int), putdat);
c0109bb8:	8b 45 14             	mov    0x14(%ebp),%eax
c0109bbb:	8d 50 04             	lea    0x4(%eax),%edx
c0109bbe:	89 55 14             	mov    %edx,0x14(%ebp)
c0109bc1:	8b 00                	mov    (%eax),%eax
c0109bc3:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109bc6:	89 54 24 04          	mov    %edx,0x4(%esp)
c0109bca:	89 04 24             	mov    %eax,(%esp)
c0109bcd:	8b 45 08             	mov    0x8(%ebp),%eax
c0109bd0:	ff d0                	call   *%eax
            break;
c0109bd2:	e9 a4 02 00 00       	jmp    c0109e7b <vprintfmt+0x3d1>

        // error message
        case 'e':
            err = va_arg(ap, int);
c0109bd7:	8b 45 14             	mov    0x14(%ebp),%eax
c0109bda:	8d 50 04             	lea    0x4(%eax),%edx
c0109bdd:	89 55 14             	mov    %edx,0x14(%ebp)
c0109be0:	8b 18                	mov    (%eax),%ebx
            if (err < 0) {
c0109be2:	85 db                	test   %ebx,%ebx
c0109be4:	79 02                	jns    c0109be8 <vprintfmt+0x13e>
                err = -err;
c0109be6:	f7 db                	neg    %ebx
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
c0109be8:	83 fb 06             	cmp    $0x6,%ebx
c0109beb:	7f 0b                	jg     c0109bf8 <vprintfmt+0x14e>
c0109bed:	8b 34 9d 40 c2 10 c0 	mov    -0x3fef3dc0(,%ebx,4),%esi
c0109bf4:	85 f6                	test   %esi,%esi
c0109bf6:	75 23                	jne    c0109c1b <vprintfmt+0x171>
                printfmt(putch, putdat, "error %d", err);
c0109bf8:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
c0109bfc:	c7 44 24 08 6d c2 10 	movl   $0xc010c26d,0x8(%esp)
c0109c03:	c0 
c0109c04:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109c07:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109c0b:	8b 45 08             	mov    0x8(%ebp),%eax
c0109c0e:	89 04 24             	mov    %eax,(%esp)
c0109c11:	e8 61 fe ff ff       	call   c0109a77 <printfmt>
            }
            else {
                printfmt(putch, putdat, "%s", p);
            }
            break;
c0109c16:	e9 60 02 00 00       	jmp    c0109e7b <vprintfmt+0x3d1>
                printfmt(putch, putdat, "%s", p);
c0109c1b:	89 74 24 0c          	mov    %esi,0xc(%esp)
c0109c1f:	c7 44 24 08 76 c2 10 	movl   $0xc010c276,0x8(%esp)
c0109c26:	c0 
c0109c27:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109c2a:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109c2e:	8b 45 08             	mov    0x8(%ebp),%eax
c0109c31:	89 04 24             	mov    %eax,(%esp)
c0109c34:	e8 3e fe ff ff       	call   c0109a77 <printfmt>
            break;
c0109c39:	e9 3d 02 00 00       	jmp    c0109e7b <vprintfmt+0x3d1>

        // string
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
c0109c3e:	8b 45 14             	mov    0x14(%ebp),%eax
c0109c41:	8d 50 04             	lea    0x4(%eax),%edx
c0109c44:	89 55 14             	mov    %edx,0x14(%ebp)
c0109c47:	8b 30                	mov    (%eax),%esi
c0109c49:	85 f6                	test   %esi,%esi
c0109c4b:	75 05                	jne    c0109c52 <vprintfmt+0x1a8>
                p = "(null)";
c0109c4d:	be 79 c2 10 c0       	mov    $0xc010c279,%esi
            }
            if (width > 0 && padc != '-') {
c0109c52:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109c56:	7e 76                	jle    c0109cce <vprintfmt+0x224>
c0109c58:	80 7d db 2d          	cmpb   $0x2d,-0x25(%ebp)
c0109c5c:	74 70                	je     c0109cce <vprintfmt+0x224>
                for (width -= strnlen(p, precision); width > 0; width --) {
c0109c5e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
c0109c61:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109c65:	89 34 24             	mov    %esi,(%esp)
c0109c68:	e8 ba f7 ff ff       	call   c0109427 <strnlen>
c0109c6d:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0109c70:	29 c2                	sub    %eax,%edx
c0109c72:	89 d0                	mov    %edx,%eax
c0109c74:	89 45 e8             	mov    %eax,-0x18(%ebp)
c0109c77:	eb 16                	jmp    c0109c8f <vprintfmt+0x1e5>
                    putch(padc, putdat);
c0109c79:	0f be 45 db          	movsbl -0x25(%ebp),%eax
c0109c7d:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109c80:	89 54 24 04          	mov    %edx,0x4(%esp)
c0109c84:	89 04 24             	mov    %eax,(%esp)
c0109c87:	8b 45 08             	mov    0x8(%ebp),%eax
c0109c8a:	ff d0                	call   *%eax
                for (width -= strnlen(p, precision); width > 0; width --) {
c0109c8c:	ff 4d e8             	decl   -0x18(%ebp)
c0109c8f:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109c93:	7f e4                	jg     c0109c79 <vprintfmt+0x1cf>
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c0109c95:	eb 37                	jmp    c0109cce <vprintfmt+0x224>
                if (altflag && (ch < ' ' || ch > '~')) {
c0109c97:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
c0109c9b:	74 1f                	je     c0109cbc <vprintfmt+0x212>
c0109c9d:	83 fb 1f             	cmp    $0x1f,%ebx
c0109ca0:	7e 05                	jle    c0109ca7 <vprintfmt+0x1fd>
c0109ca2:	83 fb 7e             	cmp    $0x7e,%ebx
c0109ca5:	7e 15                	jle    c0109cbc <vprintfmt+0x212>
                    putch('?', putdat);
c0109ca7:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109caa:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109cae:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
c0109cb5:	8b 45 08             	mov    0x8(%ebp),%eax
c0109cb8:	ff d0                	call   *%eax
c0109cba:	eb 0f                	jmp    c0109ccb <vprintfmt+0x221>
                }
                else {
                    putch(ch, putdat);
c0109cbc:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109cbf:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109cc3:	89 1c 24             	mov    %ebx,(%esp)
c0109cc6:	8b 45 08             	mov    0x8(%ebp),%eax
c0109cc9:	ff d0                	call   *%eax
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
c0109ccb:	ff 4d e8             	decl   -0x18(%ebp)
c0109cce:	89 f0                	mov    %esi,%eax
c0109cd0:	8d 70 01             	lea    0x1(%eax),%esi
c0109cd3:	0f b6 00             	movzbl (%eax),%eax
c0109cd6:	0f be d8             	movsbl %al,%ebx
c0109cd9:	85 db                	test   %ebx,%ebx
c0109cdb:	74 27                	je     c0109d04 <vprintfmt+0x25a>
c0109cdd:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0109ce1:	78 b4                	js     c0109c97 <vprintfmt+0x1ed>
c0109ce3:	ff 4d e4             	decl   -0x1c(%ebp)
c0109ce6:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
c0109cea:	79 ab                	jns    c0109c97 <vprintfmt+0x1ed>
                }
            }
            for (; width > 0; width --) {
c0109cec:	eb 16                	jmp    c0109d04 <vprintfmt+0x25a>
                putch(' ', putdat);
c0109cee:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109cf1:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109cf5:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
c0109cfc:	8b 45 08             	mov    0x8(%ebp),%eax
c0109cff:	ff d0                	call   *%eax
            for (; width > 0; width --) {
c0109d01:	ff 4d e8             	decl   -0x18(%ebp)
c0109d04:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c0109d08:	7f e4                	jg     c0109cee <vprintfmt+0x244>
            }
            break;
c0109d0a:	e9 6c 01 00 00       	jmp    c0109e7b <vprintfmt+0x3d1>

        // (signed) decimal
        case 'd':
            num = getint(&ap, lflag);
c0109d0f:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109d12:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d16:	8d 45 14             	lea    0x14(%ebp),%eax
c0109d19:	89 04 24             	mov    %eax,(%esp)
c0109d1c:	e8 0b fd ff ff       	call   c0109a2c <getint>
c0109d21:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109d24:	89 55 f4             	mov    %edx,-0xc(%ebp)
            if ((long long)num < 0) {
c0109d27:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109d2a:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109d2d:	85 d2                	test   %edx,%edx
c0109d2f:	79 26                	jns    c0109d57 <vprintfmt+0x2ad>
                putch('-', putdat);
c0109d31:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109d34:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d38:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
c0109d3f:	8b 45 08             	mov    0x8(%ebp),%eax
c0109d42:	ff d0                	call   *%eax
                num = -(long long)num;
c0109d44:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109d47:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109d4a:	f7 d8                	neg    %eax
c0109d4c:	83 d2 00             	adc    $0x0,%edx
c0109d4f:	f7 da                	neg    %edx
c0109d51:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109d54:	89 55 f4             	mov    %edx,-0xc(%ebp)
            }
            base = 10;
c0109d57:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c0109d5e:	e9 a8 00 00 00       	jmp    c0109e0b <vprintfmt+0x361>

        // unsigned decimal
        case 'u':
            num = getuint(&ap, lflag);
c0109d63:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109d66:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d6a:	8d 45 14             	lea    0x14(%ebp),%eax
c0109d6d:	89 04 24             	mov    %eax,(%esp)
c0109d70:	e8 64 fc ff ff       	call   c01099d9 <getuint>
c0109d75:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109d78:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 10;
c0109d7b:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
c0109d82:	e9 84 00 00 00       	jmp    c0109e0b <vprintfmt+0x361>

        // (unsigned) octal
        case 'o':
            num = getuint(&ap, lflag);
c0109d87:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109d8a:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109d8e:	8d 45 14             	lea    0x14(%ebp),%eax
c0109d91:	89 04 24             	mov    %eax,(%esp)
c0109d94:	e8 40 fc ff ff       	call   c01099d9 <getuint>
c0109d99:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109d9c:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 8;
c0109d9f:	c7 45 ec 08 00 00 00 	movl   $0x8,-0x14(%ebp)
            goto number;
c0109da6:	eb 63                	jmp    c0109e0b <vprintfmt+0x361>

        // pointer
        case 'p':
            putch('0', putdat);
c0109da8:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109dab:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109daf:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
c0109db6:	8b 45 08             	mov    0x8(%ebp),%eax
c0109db9:	ff d0                	call   *%eax
            putch('x', putdat);
c0109dbb:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109dbe:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109dc2:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
c0109dc9:	8b 45 08             	mov    0x8(%ebp),%eax
c0109dcc:	ff d0                	call   *%eax
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
c0109dce:	8b 45 14             	mov    0x14(%ebp),%eax
c0109dd1:	8d 50 04             	lea    0x4(%eax),%edx
c0109dd4:	89 55 14             	mov    %edx,0x14(%ebp)
c0109dd7:	8b 00                	mov    (%eax),%eax
c0109dd9:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109ddc:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
            base = 16;
c0109de3:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
            goto number;
c0109dea:	eb 1f                	jmp    c0109e0b <vprintfmt+0x361>

        // (unsigned) hexadecimal
        case 'x':
            num = getuint(&ap, lflag);
c0109dec:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109def:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109df3:	8d 45 14             	lea    0x14(%ebp),%eax
c0109df6:	89 04 24             	mov    %eax,(%esp)
c0109df9:	e8 db fb ff ff       	call   c01099d9 <getuint>
c0109dfe:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109e01:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 16;
c0109e04:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
        number:
            printnum(putch, putdat, num, base, width, padc);
c0109e0b:	0f be 55 db          	movsbl -0x25(%ebp),%edx
c0109e0f:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109e12:	89 54 24 18          	mov    %edx,0x18(%esp)
c0109e16:	8b 55 e8             	mov    -0x18(%ebp),%edx
c0109e19:	89 54 24 14          	mov    %edx,0x14(%esp)
c0109e1d:	89 44 24 10          	mov    %eax,0x10(%esp)
c0109e21:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109e24:	8b 55 f4             	mov    -0xc(%ebp),%edx
c0109e27:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109e2b:	89 54 24 0c          	mov    %edx,0xc(%esp)
c0109e2f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e32:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109e36:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e39:	89 04 24             	mov    %eax,(%esp)
c0109e3c:	e8 94 fa ff ff       	call   c01098d5 <printnum>
            break;
c0109e41:	eb 38                	jmp    c0109e7b <vprintfmt+0x3d1>

        // escaped '%' character
        case '%':
            putch(ch, putdat);
c0109e43:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e46:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109e4a:	89 1c 24             	mov    %ebx,(%esp)
c0109e4d:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e50:	ff d0                	call   *%eax
            break;
c0109e52:	eb 27                	jmp    c0109e7b <vprintfmt+0x3d1>

        // unrecognized escape sequence - just print it literally
        default:
            putch('%', putdat);
c0109e54:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e57:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109e5b:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
c0109e62:	8b 45 08             	mov    0x8(%ebp),%eax
c0109e65:	ff d0                	call   *%eax
            for (fmt --; fmt[-1] != '%'; fmt --)
c0109e67:	ff 4d 10             	decl   0x10(%ebp)
c0109e6a:	eb 03                	jmp    c0109e6f <vprintfmt+0x3c5>
c0109e6c:	ff 4d 10             	decl   0x10(%ebp)
c0109e6f:	8b 45 10             	mov    0x10(%ebp),%eax
c0109e72:	48                   	dec    %eax
c0109e73:	0f b6 00             	movzbl (%eax),%eax
c0109e76:	3c 25                	cmp    $0x25,%al
c0109e78:	75 f2                	jne    c0109e6c <vprintfmt+0x3c2>
                /* do nothing */;
            break;
c0109e7a:	90                   	nop
    while (1) {
c0109e7b:	e9 36 fc ff ff       	jmp    c0109ab6 <vprintfmt+0xc>
                return;
c0109e80:	90                   	nop
        }
    }
}
c0109e81:	83 c4 40             	add    $0x40,%esp
c0109e84:	5b                   	pop    %ebx
c0109e85:	5e                   	pop    %esi
c0109e86:	5d                   	pop    %ebp
c0109e87:	c3                   	ret    

c0109e88 <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:         the character will be printed
 * @b:          the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
c0109e88:	f3 0f 1e fb          	endbr32 
c0109e8c:	55                   	push   %ebp
c0109e8d:	89 e5                	mov    %esp,%ebp
    b->cnt ++;
c0109e8f:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e92:	8b 40 08             	mov    0x8(%eax),%eax
c0109e95:	8d 50 01             	lea    0x1(%eax),%edx
c0109e98:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109e9b:	89 50 08             	mov    %edx,0x8(%eax)
    if (b->buf < b->ebuf) {
c0109e9e:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109ea1:	8b 10                	mov    (%eax),%edx
c0109ea3:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109ea6:	8b 40 04             	mov    0x4(%eax),%eax
c0109ea9:	39 c2                	cmp    %eax,%edx
c0109eab:	73 12                	jae    c0109ebf <sprintputch+0x37>
        *b->buf ++ = ch;
c0109ead:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109eb0:	8b 00                	mov    (%eax),%eax
c0109eb2:	8d 48 01             	lea    0x1(%eax),%ecx
c0109eb5:	8b 55 0c             	mov    0xc(%ebp),%edx
c0109eb8:	89 0a                	mov    %ecx,(%edx)
c0109eba:	8b 55 08             	mov    0x8(%ebp),%edx
c0109ebd:	88 10                	mov    %dl,(%eax)
    }
}
c0109ebf:	90                   	nop
c0109ec0:	5d                   	pop    %ebp
c0109ec1:	c3                   	ret    

c0109ec2 <snprintf>:
 * @str:        the buffer to place the result into
 * @size:       the size of buffer, including the trailing null space
 * @fmt:        the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
c0109ec2:	f3 0f 1e fb          	endbr32 
c0109ec6:	55                   	push   %ebp
c0109ec7:	89 e5                	mov    %esp,%ebp
c0109ec9:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
c0109ecc:	8d 45 14             	lea    0x14(%ebp),%eax
c0109ecf:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vsnprintf(str, size, fmt, ap);
c0109ed2:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109ed5:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109ed9:	8b 45 10             	mov    0x10(%ebp),%eax
c0109edc:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109ee0:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109ee3:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109ee7:	8b 45 08             	mov    0x8(%ebp),%eax
c0109eea:	89 04 24             	mov    %eax,(%esp)
c0109eed:	e8 08 00 00 00       	call   c0109efa <vsnprintf>
c0109ef2:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
c0109ef5:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0109ef8:	c9                   	leave  
c0109ef9:	c3                   	ret    

c0109efa <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
c0109efa:	f3 0f 1e fb          	endbr32 
c0109efe:	55                   	push   %ebp
c0109eff:	89 e5                	mov    %esp,%ebp
c0109f01:	83 ec 28             	sub    $0x28,%esp
    struct sprintbuf b = {str, str + size - 1, 0};
c0109f04:	8b 45 08             	mov    0x8(%ebp),%eax
c0109f07:	89 45 ec             	mov    %eax,-0x14(%ebp)
c0109f0a:	8b 45 0c             	mov    0xc(%ebp),%eax
c0109f0d:	8d 50 ff             	lea    -0x1(%eax),%edx
c0109f10:	8b 45 08             	mov    0x8(%ebp),%eax
c0109f13:	01 d0                	add    %edx,%eax
c0109f15:	89 45 f0             	mov    %eax,-0x10(%ebp)
c0109f18:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if (str == NULL || b.buf > b.ebuf) {
c0109f1f:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
c0109f23:	74 0a                	je     c0109f2f <vsnprintf+0x35>
c0109f25:	8b 55 ec             	mov    -0x14(%ebp),%edx
c0109f28:	8b 45 f0             	mov    -0x10(%ebp),%eax
c0109f2b:	39 c2                	cmp    %eax,%edx
c0109f2d:	76 07                	jbe    c0109f36 <vsnprintf+0x3c>
        return -E_INVAL;
c0109f2f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
c0109f34:	eb 2a                	jmp    c0109f60 <vsnprintf+0x66>
    }
    // print the string to the buffer
    vprintfmt((void*)sprintputch, &b, fmt, ap);
c0109f36:	8b 45 14             	mov    0x14(%ebp),%eax
c0109f39:	89 44 24 0c          	mov    %eax,0xc(%esp)
c0109f3d:	8b 45 10             	mov    0x10(%ebp),%eax
c0109f40:	89 44 24 08          	mov    %eax,0x8(%esp)
c0109f44:	8d 45 ec             	lea    -0x14(%ebp),%eax
c0109f47:	89 44 24 04          	mov    %eax,0x4(%esp)
c0109f4b:	c7 04 24 88 9e 10 c0 	movl   $0xc0109e88,(%esp)
c0109f52:	e8 53 fb ff ff       	call   c0109aaa <vprintfmt>
    // null terminate the buffer
    *b.buf = '\0';
c0109f57:	8b 45 ec             	mov    -0x14(%ebp),%eax
c0109f5a:	c6 00 00             	movb   $0x0,(%eax)
    return b.cnt;
c0109f5d:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
c0109f60:	c9                   	leave  
c0109f61:	c3                   	ret    

c0109f62 <hash32>:
 * @bits:   the number of bits in a return value
 *
 * High bits are more random, so we use them.
 * */
uint32_t
hash32(uint32_t val, unsigned int bits) {
c0109f62:	f3 0f 1e fb          	endbr32 
c0109f66:	55                   	push   %ebp
c0109f67:	89 e5                	mov    %esp,%ebp
c0109f69:	83 ec 10             	sub    $0x10,%esp
    uint32_t hash = val * GOLDEN_RATIO_PRIME_32;
c0109f6c:	8b 45 08             	mov    0x8(%ebp),%eax
c0109f6f:	69 c0 01 00 37 9e    	imul   $0x9e370001,%eax,%eax
c0109f75:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (hash >> (32 - bits));
c0109f78:	b8 20 00 00 00       	mov    $0x20,%eax
c0109f7d:	2b 45 0c             	sub    0xc(%ebp),%eax
c0109f80:	8b 55 fc             	mov    -0x4(%ebp),%edx
c0109f83:	88 c1                	mov    %al,%cl
c0109f85:	d3 ea                	shr    %cl,%edx
c0109f87:	89 d0                	mov    %edx,%eax
}
c0109f89:	c9                   	leave  
c0109f8a:	c3                   	ret    

c0109f8b <rand>:
 * rand - returns a pseudo-random integer
 *
 * The rand() function return a value in the range [0, RAND_MAX].
 * */
int
rand(void) {
c0109f8b:	f3 0f 1e fb          	endbr32 
c0109f8f:	55                   	push   %ebp
c0109f90:	89 e5                	mov    %esp,%ebp
c0109f92:	57                   	push   %edi
c0109f93:	56                   	push   %esi
c0109f94:	53                   	push   %ebx
c0109f95:	83 ec 24             	sub    $0x24,%esp
    next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
c0109f98:	a1 80 8a 12 c0       	mov    0xc0128a80,%eax
c0109f9d:	8b 15 84 8a 12 c0    	mov    0xc0128a84,%edx
c0109fa3:	69 fa 6d e6 ec de    	imul   $0xdeece66d,%edx,%edi
c0109fa9:	6b f0 05             	imul   $0x5,%eax,%esi
c0109fac:	01 fe                	add    %edi,%esi
c0109fae:	bf 6d e6 ec de       	mov    $0xdeece66d,%edi
c0109fb3:	f7 e7                	mul    %edi
c0109fb5:	01 d6                	add    %edx,%esi
c0109fb7:	89 f2                	mov    %esi,%edx
c0109fb9:	83 c0 0b             	add    $0xb,%eax
c0109fbc:	83 d2 00             	adc    $0x0,%edx
c0109fbf:	89 c7                	mov    %eax,%edi
c0109fc1:	83 e7 ff             	and    $0xffffffff,%edi
c0109fc4:	89 f9                	mov    %edi,%ecx
c0109fc6:	0f b7 da             	movzwl %dx,%ebx
c0109fc9:	89 0d 80 8a 12 c0    	mov    %ecx,0xc0128a80
c0109fcf:	89 1d 84 8a 12 c0    	mov    %ebx,0xc0128a84
    unsigned long long result = (next >> 12);
c0109fd5:	a1 80 8a 12 c0       	mov    0xc0128a80,%eax
c0109fda:	8b 15 84 8a 12 c0    	mov    0xc0128a84,%edx
c0109fe0:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
c0109fe4:	c1 ea 0c             	shr    $0xc,%edx
c0109fe7:	89 45 e0             	mov    %eax,-0x20(%ebp)
c0109fea:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return (int)do_div(result, RAND_MAX + 1);
c0109fed:	c7 45 dc 00 00 00 80 	movl   $0x80000000,-0x24(%ebp)
c0109ff4:	8b 45 e0             	mov    -0x20(%ebp),%eax
c0109ff7:	8b 55 e4             	mov    -0x1c(%ebp),%edx
c0109ffa:	89 45 d8             	mov    %eax,-0x28(%ebp)
c0109ffd:	89 55 e8             	mov    %edx,-0x18(%ebp)
c010a000:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a003:	89 45 ec             	mov    %eax,-0x14(%ebp)
c010a006:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
c010a00a:	74 1c                	je     c010a028 <rand+0x9d>
c010a00c:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a00f:	ba 00 00 00 00       	mov    $0x0,%edx
c010a014:	f7 75 dc             	divl   -0x24(%ebp)
c010a017:	89 55 ec             	mov    %edx,-0x14(%ebp)
c010a01a:	8b 45 e8             	mov    -0x18(%ebp),%eax
c010a01d:	ba 00 00 00 00       	mov    $0x0,%edx
c010a022:	f7 75 dc             	divl   -0x24(%ebp)
c010a025:	89 45 e8             	mov    %eax,-0x18(%ebp)
c010a028:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a02b:	8b 55 ec             	mov    -0x14(%ebp),%edx
c010a02e:	f7 75 dc             	divl   -0x24(%ebp)
c010a031:	89 45 d8             	mov    %eax,-0x28(%ebp)
c010a034:	89 55 d4             	mov    %edx,-0x2c(%ebp)
c010a037:	8b 45 d8             	mov    -0x28(%ebp),%eax
c010a03a:	8b 55 e8             	mov    -0x18(%ebp),%edx
c010a03d:	89 45 e0             	mov    %eax,-0x20(%ebp)
c010a040:	89 55 e4             	mov    %edx,-0x1c(%ebp)
c010a043:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
c010a046:	83 c4 24             	add    $0x24,%esp
c010a049:	5b                   	pop    %ebx
c010a04a:	5e                   	pop    %esi
c010a04b:	5f                   	pop    %edi
c010a04c:	5d                   	pop    %ebp
c010a04d:	c3                   	ret    

c010a04e <srand>:
/* *
 * srand - seed the random number generator with the given number
 * @seed:   the required seed number
 * */
void
srand(unsigned int seed) {
c010a04e:	f3 0f 1e fb          	endbr32 
c010a052:	55                   	push   %ebp
c010a053:	89 e5                	mov    %esp,%ebp
    next = seed;
c010a055:	8b 45 08             	mov    0x8(%ebp),%eax
c010a058:	ba 00 00 00 00       	mov    $0x0,%edx
c010a05d:	a3 80 8a 12 c0       	mov    %eax,0xc0128a80
c010a062:	89 15 84 8a 12 c0    	mov    %edx,0xc0128a84
}
c010a068:	90                   	nop
c010a069:	5d                   	pop    %ebp
c010a06a:	c3                   	ret    
